{"id":13482038,"url":"https://github.com/aio-libs/aiopg","last_synced_at":"2025-05-14T02:04:05.835Z","repository":{"id":15661074,"uuid":"18398494","full_name":"aio-libs/aiopg","owner":"aio-libs","description":"aiopg is a library for accessing a PostgreSQL database from the asyncio","archived":false,"fork":false,"pushed_at":"2024-05-27T04:52:30.000Z","size":1180,"stargazers_count":1409,"open_issues_count":79,"forks_count":161,"subscribers_count":37,"default_branch":"master","last_synced_at":"2025-05-03T00:02:14.169Z","etag":null,"topics":["asyncio","postgresql","sqlalchemy"],"latest_commit_sha":null,"homepage":"http://aiopg.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aio-libs.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.txt","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-04-03T09:58:33.000Z","updated_at":"2025-04-29T08:58:40.000Z","dependencies_parsed_at":"2024-01-05T21:20:12.420Z","dependency_job_id":"d82454bd-ee6b-4b89-8273-7bbdfc8abaab","html_url":"https://github.com/aio-libs/aiopg","commit_stats":{"total_commits":881,"total_committers":63,"mean_commits":"13.984126984126984","dds":0.5425652667423382,"last_synced_commit":"7b01833100b83f65ba64a5ba877eabc369242b8b"},"previous_names":[],"tags_count":63,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aio-libs%2Faiopg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aio-libs%2Faiopg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aio-libs%2Faiopg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aio-libs%2Faiopg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aio-libs","download_url":"https://codeload.github.com/aio-libs/aiopg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252506585,"owners_count":21759078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","postgresql","sqlalchemy"],"created_at":"2024-07-31T17:00:58.413Z","updated_at":"2025-05-14T02:04:05.790Z","avatar_url":"https://github.com/aio-libs.png","language":"Python","funding_links":[],"categories":["Python","Database Drivers"],"sub_categories":[],"readme":"aiopg\n=====\n.. image:: https://github.com/aio-libs/aiopg/workflows/CI/badge.svg\n   :target: https://github.com/aio-libs/aiopg/actions?query=workflow%3ACI\n.. image:: https://codecov.io/gh/aio-libs/aiopg/branch/master/graph/badge.svg\n   :target: https://codecov.io/gh/aio-libs/aiopg\n.. image:: https://badges.gitter.im/Join%20Chat.svg\n    :target: https://gitter.im/aio-libs/Lobby\n    :alt: Chat on Gitter\n\n**aiopg** is a library for accessing a PostgreSQL_ database\nfrom the asyncio_ (PEP-3156/tulip) framework. It wraps\nasynchronous features of the Psycopg database driver.\n\nExample\n-------\n\n.. code:: python\n\n    import asyncio\n    import aiopg\n\n    dsn = 'dbname=aiopg user=aiopg password=passwd host=127.0.0.1'\n\n    async def go():\n        pool = await aiopg.create_pool(dsn)\n        async with pool.acquire() as conn:\n            async with conn.cursor() as cur:\n                await cur.execute(\"SELECT 1\")\n                ret = []\n                async for row in cur:\n                    ret.append(row)\n                assert ret == [(1,)]\n\n    loop = asyncio.get_event_loop()\n    loop.run_until_complete(go())\n\n\nExample of SQLAlchemy optional integration\n------------------------------------------\n\n.. code:: python\n\n   import asyncio\n   from aiopg.sa import create_engine\n   import sqlalchemy as sa\n\n   metadata = sa.MetaData()\n\n   tbl = sa.Table('tbl', metadata,\n       sa.Column('id', sa.Integer, primary_key=True),\n       sa.Column('val', sa.String(255)))\n\n   async def create_table(engine):\n       async with engine.acquire() as conn:\n           await conn.execute('DROP TABLE IF EXISTS tbl')\n           await conn.execute('''CREATE TABLE tbl (\n                                     id serial PRIMARY KEY,\n                                     val varchar(255))''')\n\n   async def go():\n       async with create_engine(user='aiopg',\n                                database='aiopg',\n                                host='127.0.0.1',\n                                password='passwd') as engine:\n\n           async with engine.acquire() as conn:\n               await conn.execute(tbl.insert().values(val='abc'))\n\n               async for row in conn.execute(tbl.select()):\n                   print(row.id, row.val)\n\n   loop = asyncio.get_event_loop()\n   loop.run_until_complete(go())\n\n.. _PostgreSQL: http://www.postgresql.org/\n.. _asyncio: https://docs.python.org/3/library/asyncio.html\n\nPlease use::\n\n   $ make test\n\nfor executing the project's unittests.\nSee https://aiopg.readthedocs.io/en/stable/contributing.html for details\non how to set up your environment to run the tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faio-libs%2Faiopg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faio-libs%2Faiopg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faio-libs%2Faiopg/lists"}