aiopg

aiopg is a library for accessing a PostgreSQL database from the asyncio

Latest version: 1.5.0a1 registry icon
Maintenance score
0
Safety score
0
Popularity score
73
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
1.5.0a1 0 0 0 0 0
1.4.0 0 0 0 0 0
1.3.5 0 0 0 0 0
1.3.4 0 0 0 0 0
1.3.4b3 0 0 0 0 0
1.3.3 0 0 0 0 0
1.3.2 0 0 0 0 0
1.3.2b2 0 0 0 0 0
1.3.2b1 0 0 0 0 0
1.3.1 0 0 0 0 0
1.3.1b2 0 0 0 0 0
1.3.1b1 0 0 0 0 0
1.3.0b4 0 0 0 0 0
1.3.0b3 0 0 0 0 0
1.3.0b2 0 0 0 0 0
1.3.0b1 0 0 0 0 0
1.3.0b0 0 0 0 0 0
1.3.0 0 0 0 0 0
1.2.1 0 0 0 0 0
1.2.0b4 0 0 0 0 0
1.2.0b3 0 0 0 0 0
1.2.0b2 0 0 0 0 0
1.2.0b1 0 0 0 0 0
1.2.0b0 0 0 0 0 0
1.2.0 0 0 0 0 0
1.1.0b2 0 0 0 0 0
1.1.0b1 0 0 0 0 0
1.1.0a0 0 0 0 0 0
1.1.0 0 0 0 0 0
1.0.0 0 0 0 0 0
0.16.0 0 0 0 0 0
0.15.0 0 0 0 0 0
0.14.0 0 0 0 0 0
0.13.2 0 0 0 0 0
0.13.1 0 0 0 0 0
0.13.0 0 0 0 0 0
0.12.0 0 0 0 0 0
0.11.0 0 0 0 0 0
0.10.0 0 0 0 0 0
0.9.2 0 0 0 0 0
0.9.0 0 0 0 0 0
0.8.0 0 0 0 0 0
0.7.0 0 0 0 0 0
0.6.1 0 0 0 0 0
0.6.0 0 0 0 0 0
0.5.2 0 0 0 0 0
0.5.1 0 0 0 0 0
0.5.0 0 0 0 0 0
0.4.1 0 0 0 0 0
0.4.0 0 0 0 0 0
0.3.2 0 0 0 0 0
0.3.1 0 0 0 0 0
0.2.3 0 0 0 0 0
0.2.2 0 0 0 0 0
0.2.1 0 0 0 0 0
0.2.0 0 0 0 0 0
0.1.2 0 0 0 0 0
0.1.1 0 0 0 0 0
0.1.0 0 0 0 0 0

Stability
Latest release:

1.5.0a1 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

BSD   -   BSD License (Generic)

Is a wildcard

Not proprietary

OSI Compliant



aiopg

.. image:: https://github.com/aio-libs/aiopg/workflows/CI/badge.svg :target: https://github.com/aio-libs/aiopg/actions?query=workflow%3ACI .. image:: https://codecov.io/gh/aio-libs/aiopg/branch/master/graph/badge.svg :target: https://codecov.io/gh/aio-libs/aiopg .. image:: https://badges.gitter.im/Join%20Chat.svg :target: https://gitter.im/aio-libs/Lobby :alt: Chat on Gitter

aiopg is a library for accessing a PostgreSQL_ database from the asyncio_ (PEP-3156/tulip) framework. It wraps asynchronous features of the Psycopg database driver.

Example

.. code:: python

import asyncio
import aiopg

dsn = 'dbname=aiopg user=aiopg password=passwd host=127.0.0.1'

async def go():
    pool = await aiopg.create_pool(dsn)
    async with pool.acquire() as conn:
        async with conn.cursor() as cur:
            await cur.execute("SELECT 1")
            ret = []
            async for row in cur:
                ret.append(row)
            assert ret == [(1,)]

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

Example of SQLAlchemy optional integration

.. code:: python

import asyncio from aiopg.sa import create_engine import sqlalchemy as sa

metadata = sa.MetaData()

tbl = sa.Table('tbl', metadata, sa.Column('id', sa.Integer, primary_key=True), sa.Column('val', sa.String(255)))

async def create_table(engine): async with engine.acquire() as conn: await conn.execute('DROP TABLE IF EXISTS tbl') await conn.execute('''CREATE TABLE tbl ( id serial PRIMARY KEY, val varchar(255))''')

async def go(): async with create_engine(user='aiopg', database='aiopg', host='127.0.0.1', password='passwd') as engine:

       async with engine.acquire() as conn:
           await conn.execute(tbl.insert().values(val='abc'))

           async for row in conn.execute(tbl.select()):
               print(row.id, row.val)

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

.. _PostgreSQL: http://www.postgresql.org/ .. _asyncio: https://docs.python.org/3/library/asyncio.html

Please use::

$ make test

for executing the project's unittests. See https://aiopg.readthedocs.io/en/stable/contributing.html for details on how to set up your environment to run the tests.