Skip to content Skip to sidebar Skip to footer

Is It Possible To Asynchronously Query Sql Server From Python (3.4)?

Is it possible to perform asynchronous queries against Microsoft SQL Server from Python (3.4), i.e. in the context of an asyncio event loop? The following is a skeleton asyncio pro

Solution 1:

For now there is only PostgreSQL native asyncio support via aiopg library.

But you can run synchronous calls to MSSQL by loop.run_in_executor().

Solution 2:

The one option I have found so far is the commercial product mxODBC Connect, which unfortunately costs several hundred dollars. By providing a proxy server to SQL Server, it is able to support asynchronous calls. Supposedly the async support is implemented via gevent, so I don't know how well it'll fit into asyncio. From Python's ODBC wiki, mxODBC is the only product listed with async support.

Solution 3:

I hate a "don't do that" answers, but the article by Mike Bayer, the creator of SQLAlchemy makes me think exactly exactly that:

"when it comes to stereotypical database logic, there are no advantages to using it versus a traditional threaded approach, and you can likely expect a small to moderate decrease in performance, not an increase"

Post a Comment for "Is It Possible To Asynchronously Query Sql Server From Python (3.4)?"