aiomysql: Query returns result from another query
Here is my problem. I use aiomysql in aiohttp handlers. Something like this:
async def handler(request):
data = await get_data(request.app['db_pool'])
async def get_data(db_pool):
# prepare query q and params
async with db_pool.acquire() as conn:
async with conn.cursor() as cur:
await cur.execute(q, params)
rows = await cur.fetchall()
# do something with rows
# and return result
And some times rows are not the result for the given query q but the result from other query. There are no errors. It just silently returns wrong result. The only way i could determine that situation was that queries had different number of fields so there was an index out of bounds error in the log some times.
So the question is - do i run it in a right way? Or should i use any locks somewhere? Or is it a bug in the library?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (6 by maintainers)
The same problem appeared on 0.1.1. I use one cursor for all requests