Came asyncpg — client library for PostgreSQL Python/asyncio
the EuroPython conference 2016 Yury Selivanov (the author of async/await syntax and the author of uvloop) has introduced a new high-performance library for asynchronous access to PostgreSQL — asyncpg. Tests show on average two times greater speed than psycopg2 (and its asynchronous variant aiopg).

The reason for high rates is that asyncpg implements binary Protocol PostgreSQL native, without the use of abstractions, like the DB-API. In addition, it is possible to obtain easy-to-use implementation:
the
the
asyncpg available on PyPI. Use pip to install:
the
the
the
PS Some of the terms such as the "prepared statement", I left without translation, and also took the liberty to use text anglicisms, as I believe meticulous translation of technical texts can distort the original meaning or hamper understanding. Please forgive me for this.
Article based on information from habrahabr.ru

The reason for high rates is that asyncpg implements binary Protocol PostgreSQL native, without the use of abstractions, like the DB-API. In addition, it is possible to obtain easy-to-use implementation:
the
- automatic encoding and decoding of composite types, arrays and their combination the
- intuitive support custom types
prepared statements
scrollable cursors
partial iteration query results the
the
Installation
asyncpg available on PyPI. Use pip to install:
the
$ pip install asyncpg
the
usage Example
the
import asyncio
import asyncpg
async def run():
conn = await asyncpg.connect(user='user', password='password',
database='database', host='127.0.0.1')
values = await conn.fetch("'SELECT * FROM mytable"')
await conn.close()
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
PS Some of the terms such as the "prepared statement", I left without translation, and also took the liberty to use text anglicisms, as I believe meticulous translation of technical texts can distort the original meaning or hamper understanding. Please forgive me for this.
Комментарии
Отправить комментарий