Connection pool is incompatible with Python 3.9
hhromic opened this issue ยท 8 comments
When using aioodbc
with a connection pool under Python 3.9, the following error is reported:
File "/usr/local/lib/python3.9/site-packages/aioodbc/pool.py", line 28, in _create_pool
with (await pool._cond):
TypeError: object Condition can't be used in 'await' expression
The affected code is:
Lines 28 to 29 in 02aa031
According to the official documentation, the asyncio.Condition
object should be handled using an async with
construct instead of a with
with an await
expression as done in aiodbc
.
I will try to send a pull request fixing this soon but I don't have much time nowadays. I also hope that this project is not abandoned either as it is very useful.
Hi @hhromic
I was going through the same issue so I have fixed the pool.py file.
I have update the lines with new construct instead of the old one.
Let me know how can I share the file with you so that you can update it in the aioodbc package.
I also don't want this project to be abandoned because it is really very useful.
Hi @hhromic
I was going through the same issue so I have fixed the pool.py file.
I have update the lines with new construct instead of the old one.Let me know how can I share the file with you so that you can update it in the aioodbc package.
I also don't want this project to be abandoned because it is really very useful.
Can you share the file with me too?
Hi @hhromic
I was going through the same issue so I have fixed the pool.py file.
I have update the lines with new construct instead of the old one.
Let me know how can I share the file with you so that you can update it in the aioodbc package.
I also don't want this project to be abandoned because it is really very useful.Can you share the file with me too?
Here is the link. File will be automatically deleted in 24 hours.
https://file.re/2021/03/18/poolnew/
Hey @jayantraizada @hhromic seems I'm hitting this issue too!
Hopefully you can submit a pull request?
This seems to be one of the only projects for AIO for ODBC...
Hey @hhromic @singlecheeze @ecoron-ai I have raise a pull request and fixed the code with new async with keyword.
Hi all,
I have tried the fix the pool.py file as per the official documentation mentioned by @hhromic . I have implemented following fixes in the file:
- Removed await before pool._cond on lines 28, 79, 108, 122 and 171
- Inserted async before with on the same lines.
After these modifications I am able to use the connection pool with python 3.9.5. I am sharing the updated pool.py file herewith. You can paste the file in /Lib/site-packages/aioodbc and should be good to go
pool.zip
Hi!!!
@nishdnr your approach works perfectly!!! Thanks !!!
it will be nice if the library is updated !!
Fixed in master.