-
-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
The project README describes being API-compatible with aiomysql, but I'm seeing an error trying to simply obtain a cursor. This code should run:
import asyncio
import aiomysql
import asyncmy
async def main(driver):
pool = await driver.create_pool(db='peewee_test', autocommit=True)
conn = await pool.acquire()
curs = await conn.cursor()
res = await curs.execute('select 1')
print(res)
pool.release(conn)
pool.close()
print('aiomysql:')
asyncio.run(main(aiomysql))
print('asyncmy:')
asyncio.run(main(asyncmy))Output is expected for aiomysql:
aiomysql:
1
asyncmy throws an error because the cursor is not awaitable:
asyncmy:
Traceback (most recent call last):
File "/home/charles/envs/notebook/x.py", line 21, in <module>
asyncio.run(main(asyncmy))
~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/asyncio/runners.py", line 204, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.14/asyncio/runners.py", line 127, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.14/asyncio/base_events.py", line 719, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/home/charles/envs/notebook/x.py", line 10, in main
curs = await conn.cursor()
^^^^^^^^^^^^^^^^^^^
TypeError: 'asyncmy.cursors.Cursor' object can't be awaited
Running asyncmy==0.2.11
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels