Repository navigation
Description
Problem
An installation allowed by matrixone-python-sdk==0.1.16 dependency metadata fails on an ordinary AsyncClient.execute() against MatrixOne v4.2.5. The error is in SQLAlchemy/aiomysql connection pre-ping, before database SQL execution. Replacing only PyMySQL 1.2.3 with 1.1.1 makes the same async query pass.
This was found while reviewing Python SDK documentation and building executable data-science tutorials (matrixorigin/matrixone-doc#518). Please document or constrain the affected dependency combination, or support it through an upstream driver/dialect fix.
Tested environment
- Python 3.12.14
- matrixone-python-sdk 0.1.16, installed from PyPI
- SQLAlchemy 2.0.43
- aiomysql 0.3.2
- failing PyMySQL 1.2.3; passing PyMySQL 1.1.1
- official matrixorigin/matrixone:4.2.5, reporting 8.0.30-MatrixOne-v4.2.5
- isolated local database; synchronous queries and bound DML work
All 48 SDK Python source files in the v4.2.5 tag match the installed wheel. This report concerns the tested dependency tuple; it does not establish failure with every SQLAlchemy/Python/PyMySQL version.
Reproduce
python -m pip install matrixone-python-sdk==0.1.16 SQLAlchemy==2.0.43 aiomysql==0.3.2 PyMySQL==1.2.3Provide MO_HOST, MO_PORT, MO_USER, MO_PASSWORD and MO_DATABASE for an existing dedicated test database.
import asyncio
import os
from matrixone import AsyncClient
async def main():
client = AsyncClient(sql_log_mode='off')
try:
await client.connect(
host=os.environ['MO_HOST'], port=int(os.environ['MO_PORT']),
user=os.environ['MO_USER'], password=os.environ['MO_PASSWORD'],
database=os.environ['MO_DATABASE'], on_connect=[])
result = await client.execute('SELECT VERSION()')
print(result.scalar())
finally:
await client.disconnect()
asyncio.run(main())Expected: server version.
Observed:
matrixone.exceptions.QueryError: Query execution failed:
AsyncAdapt_aiomysql_connection.ping() missing 1 required positional argument: 'reconnect'
Repeating with PyMySQL==1.1.1 returns the server version successfully. No server setting, database or SDK code was changed.
Relevant behavior
SQLAlchemy 2.0.43's mysql/pymysql.py _send_false_to_ping inspects PyMySQL's Connection.ping signature and chooses either ping(False) or ping(). The aiomysql adapter's ping requires a reconnect positional argument. SDK AsyncClient enables pool_pre_ping. This appears to be a dependency interoperability problem, not a MatrixOne SQL feature failure.
Please include a regression check for connection reuse/pre-ping rather than testing connect() alone. The documentation should publish a working dependency tuple and distinguish distribution metadata 0.1.16 from the module's current version value 1.0.0.
Activity
dengn commentedon Oct 15, 2026
Additional dependency control: PyPI currently resolves SQLAlchemy 2.1.4. Keeping SDK 0.1.16, PyMySQL 1.2.3, aiomysql 0.3.2 and the same MO v4.2.5 server, sync and async SELECT VERSION both pass with SQLAlchemy 2.1.4.
The failure should therefore stay scoped to the SQLAlchemy 2.0.43 tuple above. Upgrading SQLAlchemy is another demonstrated basic-query workaround, alongside using PyMySQL 1.1.1. This suggests documenting/constraining tested driver dependency combinations rather than treating it as a MatrixOne server SQL bug. The 2.1.4 check was a read-only connection/SELECT smoke test, not requalification of every SDK manager or full data-science workflow.
MatrixAdventurer commentedon Oct 15, 2026
由LW授权的ChatGPT Business智能体提交。
Deduplication/update: draft PR #30074 already changes AsyncClient pre-ping, so I did not open a competing fix. Its current head e197b1d still misses the reported SQLAlchemy 2.0.43 combination because its workaround is gated to 1.4 only. A new isolated diagnostic reproduces the exact adapter TypeError before raw ping (zero calls); 1.4.54 and 2.0.54 controls succeed with the same PyMySQL 1.2.3 / aiomysql 0.3.2 pair. Independent review confirmed the bounded finding.
Full evidence and limitations are in #30074 (comment) . This is a real driver/adapter boundary reproduction, not a full SDK/pool-reuse/MatrixOne integration pass. No product patch, PR, assignment, merge or deployment is claimed.
XuPeng-SH commentedon Oct 18, 2026
本轮合并后功能验证新增依赖组合证据(2026-10-18):
4226537e5094995155eab9c2a883db649ff7b95b,Linux/amd64,Python 3.12,SQLAlchemy 1.4.54、aiomysql 0.3.2、PyMySQL 1.2.3;真实嵌入式数据库,通过 TCP/MySQL、认证用户和独立测试数据库运行。tests/online/test_sdk_vector_batch_chunks.py实际结果:15 passed / 10 failed。10 个异步场景均在连接复用/pre-ping 返回AsyncAdapt_aiomysql_connection.ping() missing 1 required positional argument: 'reconnect';同步场景通过。不是服务端 SQL 回归。因此沿用本 issue 跟踪依赖兼容性,新增确认 1.4.54 的真实 SDK/pool-reuse 路径也受影响;不能将此前单独 adapter 控制的成功外推为完整 SDK 成功。不另建重复 issue,也不归因于 #30076 引入。已将该验证限制同步到 #30076。
原始日志、测试 overlay 与退出码保留在
/workspace/work/pr-audit-continue18/logs/main-sql-final.log、main-sdk111.log;测试仅启用仓库现有MO_TEST_CLUSTER_TCP_ONLY=1,无生产逻辑补丁。Ariznawlll commentedon Oct 26, 2026
测试版本
main861a2c4cb68961d8b6b01f18e0aa6ac52a3a505f;本地隔离 MO 服务端源码5fe08a3307e246e1ab9951ab690b50557af0f509,VERSION()=8.0.30-MatrixOne-v1.3.0,单 CN。原问题验证
本轮没有复跑 issue 原始的 SQLAlchemy 2.0.43 pre-ping 场景,不判断其修复状态。补充的是同一个 SDK 允许的
aiomysql 0.3.2 + PyMySQL 1.2.3依赖组合下,异步 ORM 绑定bytes的另一条失败路径;请勿把以下结果理解为服务端二进制存储失败。Happy Path 覆盖
VARBINARY列,SQL 字面量X'00FF'和同步 ORM 绑定b'\xff\x00'均精确写入、读回,3/3。00FF、FF00均精确读回,3/3。Unhappy Path 覆盖
async with client.session()添加带bytes的 SQLAlchemy 对象,提交时 3/3 抛TypeError: 'str' object is not callable;普通 SQLAlchemy 异步引擎绑定bytes同样 3/3 抛相同错误。失败均发生在驱动参数转义,未向表中留下行;随后SELECT 42正常。白盒验证
aiomysql 0.3.2 的
connection.escape()调用从pymysql.converters导入的escape_bytes_prefixed;PyMySQL 1.2.3 将它定义为字符串哨兵DO NOT IMPORT THIS!!!,而 1.1.1 中它是函数。SDK 当前依赖范围PyMySQL>=1.0.0、aiomysql>=0.2.0均允许失败组合。此处是依赖互操作缺口,和本 issue 已讨论的依赖约束/版本矩阵同类;不另开重复 issue。回归测试
本轮未修改仓库测试或 PR。修复依赖约束或上游驱动后,建议在异步 ORM 和普通异步引擎各加入
VARBINARY的 NUL/非 UTF-8 字节绑定与读回,覆盖受支持的依赖版本组合。测试证据
本地复现脚本:
/private/tmp/mo-sdk-complete-20261026/async_orm_binary_dependency_probe.py;1.1.1 对照:/private/tmp/mo-sdk-complete-20261026/async_orm_binary_111_control.py。两份脚本各 3 次新库运行,精确行集、失败后状态、连接可用性和清理均已断言。测试结论
测试不通过。
fix(python-sdk): unify query contracts and atomic manager operations (#…
XuPeng-SH commentedon Oct 26, 2026
QA addendum (2026-10-26): SDK
28e8760905a7f39dba2ce436357ea75492f30512, Python 3.12.14, SQLAlchemy 2.0.55, aiomysql 0.3.2 and PyMySQL 1.2.3, with isolated server83c1e23526fc0ed31188abd7fc2ca87cd3a6d4b3(v1.3.0):test_async_public_contracts_and_pre_pingpassed repeated pre-ping on this tuple. SQLAlchemy 2.0.43 and MatrixOne 4.2.5 were not used, so the original tuple remains unverified on the current SDK.Separately, the reporter's #30242 (comment) documents an async bytes-binding failure at SDK
861a2c4with aiomysql 0.3.2/PyMySQL 1.2.3; it is not a current-head rerun. The current SDK dependency metadata still permits those versions. Handing off to QA to verify the original tuple and this related driver boundary; this is not a pass claim.Ariznawlll commentedon Oct 30, 2026
结论
测试不通过。当前 main 上原依赖组合的重复 pre-ping 已通过,但本 issue 先前记录的同组异步二进制绑定仍失败,暂不能作为完整 SDK 兼容性通过。
关键证据
main@d39d8a40343ccd40bf665036388df7a40ee867f8,修复 PR fix(python-sdk): enforce handshake, TLS, redaction and async deadlines #30074 的合并提交8ef2eaf4d923bdb4136dd81a50850e8eced0f368在该版本祖先链;隔离 1 CN / 1 TN / 1 LogService,二进制和 SDK 源码同 SHA。Python 3.12、SQLAlchemy 2.0.43、aiomysql 0.3.2、PyMySQL 1.2.3。SELECT 110 次,均返回[(1,)],共 3/3 轮;所测 main 环境未再观察原 pre-ping 的 reconnect 参数错误。b'\x00\xff'写入 VARBINARY,3/3 抛出QueryError: Query execution failed: 'str' object is not callable,与本 issue 历史记录的驱动二进制互操作残留相符。每轮失败后源表为 0 行,后续SELECT 1正常,测试库清理。待解决点
fix(python-sdk): unify SQL, transaction and driver boundaries (#31889)
XuPeng-SH commentedon Oct 30, 2026
新修复转 QA:#31889 已合入 main,合并提交
91dfab2132c4c4fcd3f9a115dbfa968b196b8b14。现有连接/池 owner 安装异步 bytes 编码适配,并在实际 pre-ping owner 设置兼容参数;对应最新评论的 SQLAlchemy2.0.43/aiomysql0.3.2/PyMySQL1.2.3 bytes 与重复 pre-ping 残留。
已核对 issue 正文、完整评论及当前合并源码/测试内容。历史失败按其原 SHA 保留;新修复直接覆盖上述残留,未发现适用于新修复的已验证反例或尚未完成的开发 follow-up。本轮仅源码/测试内容静态核对,没有运行 MatrixOne 服务或 SDK 回归;作者在 PR 内的运行结果是作者证据,不是本轮独立测试。转 Ariznawlll 继续验证,不代表验收通过。
QA 待验范围:原始依赖组合、managed/已预热 adopted/shared pool、NUL/非UTF8 bytes和NULL、失败后连接可用性;历史4.2.5发行版和GBK真实连接未由本轮验证。
Ariznawlll commentedon Nov 3, 2026
结论
测试通过。所测依赖组合下,AsyncClient 重复 pre-ping 和异步二进制绑定均可正常使用。
关键证据
main@d61a7206c16b30baa4efc525eb6067c4364035aa;Python 3.12、SQLAlchemy 2.0.43、aiomysql 0.3.2、PyMySQL 1.2.3,真实隔离 MO。test_async_binary_driver.py10 项离线检查通过。已有 SDK MOTR 原场景与补充预期输出的二进制/连接池场景已加入 MOTR #305,本次联合三轮通过。待解决点
MOTR PR 尚待评审合入;测试对象是当前 main,不声称已发布的 4.2.5 二进制被修改,GBK 真实连接未覆盖。