Re: async

"Walter Dörwald" <[email protected]> Thu, 26 Oct 2017 10:47:36 +0200
Newsgroups gmane.comp.python.db.cx-oracle
Message-ID <[email protected]>
On 24 Oct 2017, at 19:57, Anthony Tuininga wrote:

> Hi Andrew,
>
> Apologies for the delay in response. I had a busy month. :-)
>
> There are no current plans to make cx_Oracle "compatible" with 
> asyncio, but
> that could change -- especially if you provided some indication of 
> what you
> meant by that request! It might be useful to create an issue on the
> cx_Oracle issues page providing some more details. That will give 
> others a
> chance to comment a well, since not everyone is on the mailing list.

I guess this would mean that for each method that talks to the database 
there should be an async version, i.e. instead of

     def print_foo():
         cursor.execute("select * from foo")
         for row in cursor:
	        print(row)

we could do:

     async def print_foo():
         await cursor.execute("select * from foo")
         async for row in cursor:
             print(row)

Then we could use cx_Oracle with other async frameworks (aiohttp, sanic 
and probably Tornado and Twisted and a bunch others) and take advantage 
of cx_Oracle's new async features.

(We can use cx_Oracle with these frameworks now, but during any calls to 
the database the code can do nothing else except wait for the answer 
from the database).

Details for async/await are in PEP 492 at 
https://www.python.org/dev/peps/pep-0492/

> Anthony
>
> On Mon, Sep 25, 2017 at 10:22 PM, Andrew Zyman <[email protected]> 
> wrote:
>
>> Hello,
>>  wonder if there are any plans to make the module "compatible" with
>> asyncio ?
>> Thank you
>> AZ

Servus,
    Walter

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot