-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix async iterator protocol in aiomysql.utils._SAConnectionContextManager #410
Comments
Did the mistake arise in this way? async def go():
engine = await create_engine(user="xxx", password="mrb", host='localhost', db="xxx")
conn = await engine._acquire()
res = conn.execute("select * from xxx.user")
async for row in res:
print(row.id) |
I don't remember but probably yes. |
I find that this error no longer occurs, and aiter of _SAConnectionContextManager returns the ResultProxy object. ResultProxy objects already have a complete iterative protocol. |
Same problem, still there! |
@jaggerwang Do you mind providing an example to reproduce the bug? I fail to find one since, as mentioned by @ruiboma, EDIT: nvm, I have managed to reproduce it myself :) |
I'm seeing this here on Python 3.8: from aiomysql import sa
app = Sanic('test app')
@app.listener('before_server_start')
async def register_db(app, loop):
connection_params = parse_db_uri(app.config['MYSQL_URI'])
app.pool = await sa.create_engine(**connection_params)
async with app.pool.acquire() as connection:
result = await connection.execute('SELECT 1')
async for row in result.fetchall():
print(row)
|
Same problem, still there |
__aiter__()
should be a non-coroutine method returning an instance having__anext__()
coroutine method.Example: aio-libs/aiopg@ef1cabe#diff-222246bbd6dde09cb363ee2c57a67887R72
The text was updated successfully, but these errors were encountered: