python-oracledb 2.0 has been released with asyncio support
python-oracledb 2.0 is here !
The main changes are:
- Support for asynchronous concurrent coding
- Support for ‘Success With Info’ warnings
- Support for configuring the SDU in Thin mode
- The future
oracledb.__future__.old_json_col_as_objhas been removed - New Connection object attributes
- New SQL Domain and Annotation attributes
- Some obsolete, long deprecated parameters like
encodingandnencodinghave been desupported - Support for the obsolete Python 3.6 release has been dropped
Check out the release announcement blog post .
just noticed a typo: connect_async should return a AsyncConnection (I was about to open a PR but it did not seem worth it to create an oracle account to sign the oca just for it)
@CaselIT do you mean the typo "The pool_class parameter is expected to be a AsyncConnectionPool Object or a subclass of AsyncConnectionPool." here ?
No this one: https://github.com/oracle/python-oracledb/blob/9645d4f9b3fb196925ac364e6dec3ab953fca222/src/oracledb/connection.py#L1750
the function connect_async returns a Connection, but should return an AsyncConnection
Thanks. And thanks for the thick-mode error comment. (I'm glad we called asyncio support a 'pre-release' in this version!) I'll leave these issues to @anthony-tuininga to resolve when he's back online.
yeah creating an async connection pool with oracledb.create_pool_async returns an asyncconnectionpool, but then returns synchronous Connection objects from pool.aquire(), of which i tried to change with connectiontype=oracledb.AsyncConnection when creating the pool, but then I get a type error
Argument of type "type[AsyncConnection]" cannot be assigned to parameter "connectiontype" of type "type[Connection]" in function "create_pool_async" "type[AsyncConnection]" is incompatible with "type[Connection]" Type "type[AsyncConnection]" cannot be assigned to type "type[Connection]"PylancereportGeneralTypeIssues
not really sure how this got into even pre-release when the default base use case does not work... also unsure as to why an async connection pool acquires sync connection objs by default if this is the intended behavior
basically:
connect_async should return AsyncConnection async_pool.acquire should return AsyncConnection
In my case the driver worked fine, it's just the typing that have a typo. At runtime everything works in my test
ok, good to hear, they just need to fix the typing then we are all good!
I just pushed the corrections to the typing declarations.
image still improper typing on pool.aquire(),
as well as async connection pool just hangs indefinitley, despite having so right now i just create and drop connection per request (gross).
@WolfEYc, the first issue I can take a look at. The second issue, however, is very vague. I am able to make use of an async connection pool without hanging and I don't have to drop/create a connection each time either. Can you file a new issue and provide details of your scenario so that I can look into it further? Thanks!
This issue is intended as an announcement. Please log any new issues separately instead of commenting here. Thank you!