On 18.10.2018 16:07, Mike Bayer wrote: > On Thu, Oct 18, 2018 at 5:46 AM M.-A. Lemburg <m...@egenix.com> wrote: >> >> On 16.10.2018 16:37, Mike Bayer wrote: >>> AFAIK , Postgresql is the only major relational database that has an >>> actual non-blocking protocol. The other databases all require that >>> "async" be simulated in the context of blocking IO. >> >> ODBC does have an async I/O API as well, but I don't know >> how wide spread the implementation of this API is among ODBC >> drivers. >> >> Python modules talking wire protocol and thus having full >> control over sockets could certainly support an async variant >> of the DB-API as well. > > right, unusual though that given async's intense popularity in Python > right now, I haven't seen any drivers doing this with say, MySQL, > which you would think would be the most obvious target, considering > there are multiple pure-Python drivers already. > >> >> E.g. we have added async support to mxODBC Connect (which uses >> its own wire protocol) via gevent a long time ago and it works >> well in that context. We did not introduce any API changes >> for this, only a config option to enable support: > > Well, "gevent" unfortunately does not count with the "async" crowd > these days, I agree it's the easiest way to get at non-blocking > behaviors but Python's asyncio is all the rage right now and it > requires very dramatic API changes.
There are certainly multiple ways to add async operations to database interactions. In ODBC, you can kick off an operation and then poll for completion. This has been in place for several years. More recent versions also have a notification model. I just brought up gevent, because it's certainly the easiest way to add async behavior to an existing application. It's also possible to integrate gevent into Python's asyncio, but I'm not sure how far that has been followed through... https://github.com/gevent/gevent/issues/982 The native Python support requires deep changes in the code. In particular, you have to make sure that all methods down to the socket calls are async. Problem is that many database modules eventually interface to a database C lib and those don't necessarily give you back control in case an operation takes longer, so it's not always possible to implement this, unless you work with threads to mimic async behavior - which is kind of besides the point :-) >> >> https://www.egenix.com/products/python/mxODBCConnect/doc/#_Toc433125695 >> >> >>> On Tue, Oct 16, 2018 at 6:02 AM M.-A. Lemburg <m...@egenix.com> wrote: >>>> >>>> Hi Nadar, >>>> >>>> we do have a set of things scheduled for a version 3.0 of >>>> the DB API (see the python.org wiki), but nothing related to >>>> async I/O yet. >>>> >>>> FWIW: I think the existing APIs can be used in an async form >>>> as well, without having to specify new ones, by simply >>>> providing an async entry point at the module level or >>>> even making the DB module itself be async only. >>>> >>>> Thanks, >>>> -- >>>> Marc-Andre Lemburg >>>> eGenix.com >>>> >>>> Professional Python Services directly from the Experts >>>>>>> Python Projects, Coaching and Consulting ... http://www.egenix.com/ >>>>>>> Python Database Interfaces ... http://products.egenix.com/ >>>>>>> Plone/Zope Database Interfaces ... http://zope.egenix.com/ >>>> ________________________________________________________________________ >>>> >>>> ::: We implement business ideas - efficiently in both time and costs ::: >>>> >>>> eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 >>>> D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg >>>> Registered at Amtsgericht Duesseldorf: HRB 46611 >>>> http://www.egenix.com/company/contact/ >>>> http://www.malemburg.com/ >>>> >>>> >>>> >>>> On 11.10.2018 21:48, Nader Hamady wrote: >>>>> Hello. >>>>> >>>>> Reaching out to find out if there have been any discusdions around a 3.0 >>>>> Database API Specification - Or something broader around async >>>>> specifications for dabatase transactions. >>>>> >>>>> Thanks in advance, >>>>> >>>>> -N >>>>> >>>>> >>>>> >>>>> Hello. >>>>> >>>>> Reaching out to find out if there have been any discusdions around a 3.0 >>>>> Database API Specification - Or something broader around async >>>>> specifications for dabatase transactions. >>>>> >>>>> Thanks in advance, >>>>> >>>>> -N >>>>> >>>>> -- >>>>> Nader B. Hamady >>>>> >>>>> >>>>> _______________________________________________ >>>>> DB-SIG maillist - DB-SIG@python.org >>>>> https://mail.python.org/mailman/listinfo/db-sig >>>>> >>>> >>>> _______________________________________________ >>>> DB-SIG maillist - DB-SIG@python.org >>>> https://mail.python.org/mailman/listinfo/db-sig >> >> -- >> Marc-Andre Lemburg >> eGenix.com >> >> Professional Python Services directly from the Experts >>>>> Python Projects, Coaching and Consulting ... http://www.egenix.com/ >>>>> Python Database Interfaces ... http://products.egenix.com/ >>>>> Plone/Zope Database Interfaces ... http://zope.egenix.com/ >> ________________________________________________________________________ >> >> ::: We implement business ideas - efficiently in both time and costs ::: >> >> eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 >> D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg >> Registered at Amtsgericht Duesseldorf: HRB 46611 >> http://www.egenix.com/company/contact/ >> http://www.malemburg.com/ >> > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > https://mail.python.org/mailman/listinfo/db-sig > -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts >>> Python Projects, Coaching and Consulting ... http://www.egenix.com/ >>> Python Database Interfaces ... http://products.egenix.com/ >>> Plone/Zope Database Interfaces ... http://zope.egenix.com/ ________________________________________________________________________ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ http://www.malemburg.com/ _______________________________________________ DB-SIG maillist - DB-SIG@python.org https://mail.python.org/mailman/listinfo/db-sig