asyncpg -- A fast PostgreSQL Database Client Library for Python/asyncio
=======================================================================
.. image:: https://github.com/MagicStack/asyncpg/workflows/Tests/badge.svg
:target: https://github.com/MagicStack/asyncpg/actions?query=workflow%3ATests+branch%3Amaster
:alt: GitHub Actions status
.. image:: https://img.shields.io/pypi/v/asyncpg.svg
:target: https://pypi.python.org/pypi/asyncpg
**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 <http://magic.io/blog/asyncpg-1m-rows-from-postgres-to-python/>`_.
asyncpg requires Python 3.7 or later and is supported for PostgreSQL
versions 9.5 to 15. 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 <https://magicstack.github.io/asyncpg/current/>`_.
Performance
-----------
In our testing asyncpg is, on average, **3x** faster than psycopg2
(and its asyncio variant -- aiopg).
.. image:: https://raw.githubusercontent.com/MagicStack/asyncpg/master/performance.png
:target: https://gistpreview.github.io/?b8eac294ac85da177ff82f784ff2cb60
The above results are a geometric mean of benchmarks obtained with PostgreSQL
`client driver benchmarking toolbench <https://github.com/MagicStack/pgbench>`_
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
-----------
.. code-block:: python
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/MagicStack/asyncpg",
"name": "asyncpg-dev",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7.0",
"maintainer_email": "",
"keywords": "",
"author": "MagicStack Inc",
"author_email": "hello@magic.io",
"download_url": "",
"platform": "macOS",
"description": "asyncpg -- A fast PostgreSQL Database Client Library for Python/asyncio\n=======================================================================\n\n.. image:: https://github.com/MagicStack/asyncpg/workflows/Tests/badge.svg\n :target: https://github.com/MagicStack/asyncpg/actions?query=workflow%3ATests+branch%3Amaster\n :alt: GitHub Actions status\n.. image:: https://img.shields.io/pypi/v/asyncpg.svg\n :target: https://pypi.python.org/pypi/asyncpg\n\n**asyncpg** is a database interface library designed specifically for\nPostgreSQL and Python/asyncio. asyncpg is an efficient, clean implementation\nof PostgreSQL server binary protocol for use with Python's ``asyncio``\nframework. You can read more about asyncpg in an introductory\n`blog post <http://magic.io/blog/asyncpg-1m-rows-from-postgres-to-python/>`_.\n\nasyncpg requires Python 3.7 or later and is supported for PostgreSQL\nversions 9.5 to 15. Older PostgreSQL versions or other databases implementing\nthe PostgreSQL protocol *may* work, but are not being actively tested.\n\n\nDocumentation\n-------------\n\nThe project documentation can be found\n`here <https://magicstack.github.io/asyncpg/current/>`_.\n\n\nPerformance\n-----------\n\nIn our testing asyncpg is, on average, **3x** faster than psycopg2\n(and its asyncio variant -- aiopg).\n\n.. image:: https://raw.githubusercontent.com/MagicStack/asyncpg/master/performance.png\n :target: https://gistpreview.github.io/?b8eac294ac85da177ff82f784ff2cb60\n\nThe above results are a geometric mean of benchmarks obtained with PostgreSQL\n`client driver benchmarking toolbench <https://github.com/MagicStack/pgbench>`_\nin November 2020 (click on the chart to see full details).\n\n\nFeatures\n--------\n\nasyncpg implements PostgreSQL server protocol natively and exposes its\nfeatures directly, as opposed to hiding them behind a generic facade\nlike DB-API.\n\nThis enables asyncpg to have easy-to-use support for:\n\n* **prepared statements**\n* **scrollable cursors**\n* **partial iteration** on query results\n* automatic encoding and decoding of composite types, arrays,\n and any combination of those\n* straightforward support for custom data types\n\n\nInstallation\n------------\n\nasyncpg is available on PyPI and has no dependencies.\nUse pip to install::\n\n $ pip install asyncpg\n\n\nBasic Usage\n-----------\n\n.. code-block:: python\n\n import asyncio\n import asyncpg\n\n async def run():\n conn = await asyncpg.connect(user='user', password='password',\n database='database', host='127.0.0.1')\n values = await conn.fetch(\n 'SELECT * FROM mytable WHERE id = $1',\n 10,\n )\n await conn.close()\n\n loop = asyncio.get_event_loop()\n loop.run_until_complete(run())\n\n\nLicense\n-------\n\nasyncpg is developed and distributed under the Apache 2.0 license.\n",
"bugtrack_url": null,
"license": "Apache License, Version 2.0",
"summary": "An asyncio PostgreSQL driver",
"version": "0.28.0.dev1",
"project_urls": {
"Homepage": "https://github.com/MagicStack/asyncpg"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0e63e1fe59c12ff5e91661404ed2c70c545c02e83217830ebb46c6e289c53af4",
"md5": "283c113a677fdb96beb9e1f1cf7252c5",
"sha256": "20849420cfc1fddd4be43b63f07f2002f3816b8d37a0f3a09aaeeba0f7fb3e87"
},
"downloads": -1,
"filename": "asyncpg_dev-0.28.0.dev1-cp311-cp311-macosx_10_9_universal2.whl",
"has_sig": false,
"md5_digest": "283c113a677fdb96beb9e1f1cf7252c5",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.7.0",
"size": 1085788,
"upload_time": "2023-06-02T09:17:26",
"upload_time_iso_8601": "2023-06-02T09:17:26.456472Z",
"url": "https://files.pythonhosted.org/packages/0e/63/e1fe59c12ff5e91661404ed2c70c545c02e83217830ebb46c6e289c53af4/asyncpg_dev-0.28.0.dev1-cp311-cp311-macosx_10_9_universal2.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1f9815328953e385a783d094eb6666a29d70562522aacdf8f02d5df386b96225",
"md5": "85179778c2ff335258157e81a5c3d555",
"sha256": "091f2f44d01771677d0ca77dfaa0e7dd37eb8840d3cdde8897030d408b5b4f44"
},
"downloads": -1,
"filename": "asyncpg_dev-0.28.0.dev1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl",
"has_sig": false,
"md5_digest": "85179778c2ff335258157e81a5c3d555",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.7.0",
"size": 2737465,
"upload_time": "2023-06-02T09:14:25",
"upload_time_iso_8601": "2023-06-02T09:14:25.868427Z",
"url": "https://files.pythonhosted.org/packages/1f/98/15328953e385a783d094eb6666a29d70562522aacdf8f02d5df386b96225/asyncpg_dev-0.28.0.dev1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-02 09:17:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MagicStack",
"github_project": "asyncpg",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "asyncpg-dev"
}