aws / aws/aws-advanced-python-wrapper
Support for PyMySQL
- Ngôn ngữ chính
- Python
- Star
- 98
- Fork
- 22
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 5
Mô tả
### Describe the feature
Support the usage of the pymysql connector
### Use Case
The project I'm working on uses pymysql, I tried to pass the `Connect` class to the `AwsWrapperConnection`, however, it's failing because it's casting the port argument to a `string`, even though I'm passing an `int`.
Code that's turning the port into a string:
```
def prepare_connect_info(self, host_info: HostInfo, props: Properties) -> Properties:
prop_copy: Properties = Properties(props.copy())
prop_copy["host"] = host_info.host
if host_info.is_port_specified():
prop_copy["port"] = str(host_info.port)
PropertiesUtils.remove_wrapper_props(prop_copy)
return prop_copy
```
pymysql code enforcing the int type:
`connections.py`
```
// ...
self.port = port or 3306
if type(self.port) is not int:
raise ValueError("port should be of type int")
// ...
```
I wonder if it's possible to remove that cast to string or adapt somehow to support pymysql. I'm not sure if that's all it's going to take, though.
### Proposed Solution
Remove the cast to string for the port
```
if host_info.is_port_specified():
prop_copy["port"] = host_info.port
```
or a condition for the pymysql library
### Other Information
_No response_
### Acknowledgements
- [ ] I may be able to implement this feature request
- [X] This feature might incur a breaking change
### The AWS Advanced Python Wrapper version used
1.1.1
### Python version used
3.12
### Operating System and version
Ubuntu 22.04
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu từ prepare_connect_info và theo dõi cách thuộc tính port của nó đi đến phần xác thực trong PyMySQL connections.py. Kiểm tra luồng kết nối hiện có với một cổng số nguyên và xác nhận rằng tính năng hỗ trợ hoạt động mà không làm hỏng các connector khác; được xem là hoàn tất khi một kết nối PyMySQL chấp nhận cổng đã cấu hình.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- mysql, python
- Lĩnh vực
- databases
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100