aws / aws/aws-advanced-python-wrapper

Support for PyMySQL

未关闭
#752 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Python
星标
98
派生
22
平均合并
1 天 9 小时
30 天内合并 PR
5

描述

### 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

贡献指南

打开贡献指南

调研方向

从 prepare_connect_info 开始,跟踪其 port 属性如何传递到 PyMySQL connections.py 的验证逻辑。使用整数端口检查现有的连接流程,并确认支持能够正常工作且不会破坏其他连接器;当 PyMySQL 连接接受配置的端口时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
mysql, python
领域
databases
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。