Support for PyMySQL

未关闭
#752 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

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

调研方向

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

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

描述

enhancement
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
  • 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

主要语言
Python
星标
99
派生
22
平均合并
55 分钟
30 天内合并 PR
2

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

aws/aws-advanced-python-wrapper 的其他 Issue

查看 aws/aws-advanced-python-wrapper 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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