oracle / python-oracledb

Python driver for Oracle Database conforming to the Python DB API 2.0 specification. This is the renamed, new major release of cx_Oracle
https://oracle.github.io/python-oracledb
Other
308 stars 61 forks source link

python-oracledb 2.0 has been released with asyncio support #270

Closed cjbj closed 1 month ago

cjbj commented 6 months ago

python-oracledb 2.0 is here !

The main changes are:

Check out the release announcement blog post .

Update: we removed the pre-release status from the AsyncIO support in python-oracledb 2.1

CaselIT commented 6 months ago

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)

cjbj commented 6 months ago

@CaselIT do you mean the typo "The pool_class parameter is expected to be a AsyncConnectionPool Object or a subclass of AsyncConnectionPool." here ?

CaselIT commented 6 months ago

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

cjbj commented 6 months ago

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.

WolfEYc commented 6 months ago

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

CaselIT commented 6 months ago

In my case the driver worked fine, it's just the typing that have a typo. At runtime everything works in my test

WolfEYc commented 6 months ago

ok, good to hear, they just need to fix the typing then we are all good!

anthony-tuininga commented 6 months ago

I just pushed the corrections to the typing declarations.

WolfEYc commented 4 months ago

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).

anthony-tuininga commented 4 months ago

@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!

anthony-tuininga commented 4 months ago

This issue is intended as an announcement. Please log any new issues separately instead of commenting here. Thank you!