All Projects → MagicStack → Asyncpg

MagicStack / Asyncpg

Licence: apache-2.0
A fast PostgreSQL Database Client Library for Python/asyncio.

Programming Languages

python
139335 projects - #7 most used programming language
cython
566 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Asyncpg

Uvloop
Ultra fast asyncio event loop.
Stars: ✭ 8,246 (+58.09%)
Mutual labels:  asyncio, high-performance, async-python
Asyncio
asyncio historical repository
Stars: ✭ 952 (-81.75%)
Mutual labels:  asyncio, high-performance
Peewee Async
Asynchronous interface for peewee ORM powered by asyncio
Stars: ✭ 607 (-88.36%)
Mutual labels:  asyncio, postgresql
Zanphp
PHP开发面向C10K+的高并发SOA服务 和RPC服务首选框架
Stars: ✭ 1,451 (-72.18%)
Mutual labels:  asyncio, high-performance
Smartsql
SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
Stars: ✭ 775 (-85.14%)
Mutual labels:  postgresql, high-performance
Aioodbc
aioodbc - is a library for accessing a ODBC databases from the asyncio
Stars: ✭ 206 (-96.05%)
Mutual labels:  asyncio, postgresql
Aiopg
aiopg is a library for accessing a PostgreSQL database from the asyncio
Stars: ✭ 1,097 (-78.97%)
Mutual labels:  asyncio, postgresql
Servicestack.ormlite
Fast, Simple, Typed ORM for .NET
Stars: ✭ 1,532 (-70.63%)
Mutual labels:  postgresql, high-performance
Fastapi Gino Arq Uvicorn
High-performance Async REST API, in Python. FastAPI + GINO + Arq + Uvicorn (w/ Redis and PostgreSQL).
Stars: ✭ 204 (-96.09%)
Mutual labels:  asyncio, postgresql
Tortoise Orm
Familiar asyncio ORM for python, built with relations in mind
Stars: ✭ 2,558 (-50.96%)
Mutual labels:  asyncio, postgresql
Edgedb Python
EdgeDB Python Driver
Stars: ✭ 113 (-97.83%)
Mutual labels:  asyncio, high-performance
aiounittest
Test python asyncio-based code with ease.
Stars: ✭ 53 (-98.98%)
Mutual labels:  async-python, asyncio
Piccolo
A fast, user friendly ORM and query builder which supports asyncio.
Stars: ✭ 219 (-95.8%)
Mutual labels:  asyncio, postgresql
Pgagroal
High-performance connection pool for PostgreSQL
Stars: ✭ 362 (-93.06%)
Mutual labels:  postgresql, high-performance
Libpqxx
The official C++ client API for PostgreSQL.
Stars: ✭ 492 (-90.57%)
Mutual labels:  postgresql
Postfixadmin
PostfixAdmin - web based virtual user administration interface for Postfix mail servers
Stars: ✭ 509 (-90.24%)
Mutual labels:  postgresql
Phpmyfaq
phpMyFAQ - Open Source FAQ web application for PHP and MySQL, PostgreSQL and other databases
Stars: ✭ 494 (-90.53%)
Mutual labels:  postgresql
Xxl Rpc
A high performance, distributed RPC framework.(分布式服务框架XXL-RPC)
Stars: ✭ 493 (-90.55%)
Mutual labels:  high-performance
Falcon
Free, open-source SQL client for Windows and Mac 🦅
Stars: ✭ 4,848 (-7.06%)
Mutual labels:  postgresql
Orz
a high performance, general purpose data compressor written in rust
Stars: ✭ 509 (-90.24%)
Mutual labels:  high-performance

asyncpg -- A fast PostgreSQL Database Client Library for Python/asyncio

GitHub Actions status

asyncpg is a database interface library designed specifically for PostgreSQL and Python/asyncio. asyncpg is an efficient, clean implementation of PostgreSQL server binary protocol for use with Python's asyncio framework. You can read more about asyncpg in an introductory blog post.

asyncpg requires Python 3.6 or later and is supported for PostgreSQL versions 9.5 to 14. Older PostgreSQL versions or other databases implementing the PostgreSQL protocol may work, but are not being actively tested.

Documentation

The project documentation can be found here.

Performance

In our testing asyncpg is, on average, 3x faster than psycopg2 (and its asyncio variant -- aiopg).

https://raw.githubusercontent.com/MagicStack/asyncpg/master/performance.png

The above results are a geometric mean of benchmarks obtained with PostgreSQL client driver benchmarking toolbench in November 2020 (click on the chart to see full details).

Features

asyncpg implements PostgreSQL server protocol natively and exposes its features directly, as opposed to hiding them behind a generic facade like DB-API.

This enables asyncpg to have easy-to-use support for:

  • prepared statements
  • scrollable cursors
  • partial iteration on query results
  • automatic encoding and decoding of composite types, arrays, and any combination of those
  • straightforward support for custom data types

Installation

asyncpg is available on PyPI and has no dependencies. Use pip to install:

$ pip install asyncpg

Basic Usage

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 WHERE id = $1',
        10,
    )
    await conn.close()

loop = asyncio.get_event_loop()
loop.run_until_complete(run())

License

asyncpg is developed and distributed under the Apache 2.0 license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].