Python Module now supports Asyncio

The python module for accessing Rdbhost databases has been updated. It now supports Python 3 and Python 2 with the same file. It also supports Asyncio.

It is on, and you can install it with pip.

pip install rdbhdb

It now includes request compression, so largish data insertion queries go to the server more quickly. The compression is automatic, applied to any request over about a kilobyte.

The API is the traditional DB API 2, so it is more or less a drop in replacement for other SQL database API modules.

If you are running under Asyncio and its event loop, some calls are a bit different. For example, the connect call needs an additional keyword parameter:

conn = connect(<role>, <authcode>, asyncio=True)

The execute and executemany calls are also different, as these methods involve network interaction.

yield from cur.execute('SELECT %s', 1)

The .fetch, .fetchall, .fetchmany calls are regular method calls. They 'fetch' data that is already on the client when the .execute call returns.

comments powered by Disqus