Issue
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 program, where the (async) SQL query should be fitted into the do_it
function:
import asyncio
import contextlib
@asyncio.coroutine
def do_it():
# TODO: Make an asynchronous MS SQL query, but how??
fut = asyncio.Future()
fut.set_result(None)
return fut
with contextlib.closing(asyncio.SelectorEventLoop()) as loop:
asyncio.set_event_loop(loop)
loop.run_until_complete(do_it())
print('Finished')
Solution
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.
Answered By - aknuds1
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.