All Projects → aio-libs → Aiopg

aio-libs / Aiopg

Licence: bsd-2-clause
aiopg is a library for accessing a PostgreSQL database from the asyncio

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Aiopg

fastapi-boilerplate
FastAPI boilerplate for real world production
Stars: ✭ 145 (-86.78%)
Mutual labels:  sqlalchemy, asyncio
Web Applications With Fastapi Course
Demo code and other handouts for students of our FastAPI Web Apps course.
Stars: ✭ 56 (-94.9%)
Mutual labels:  asyncio, sqlalchemy
fastapi-sqlalchemy-1.4-async
https://rogulski.it/blog/sqlalchemy-14-async-orm-with-fastapi/
Stars: ✭ 17 (-98.45%)
Mutual labels:  sqlalchemy, asyncio
fast-api-sqlalchemy-template
Dockerized web application on FastAPI, sqlalchemy1.4, PostgreSQL
Stars: ✭ 25 (-97.72%)
Mutual labels:  sqlalchemy, asyncio
Asyncpg
A fast PostgreSQL Database Client Library for Python/asyncio.
Stars: ✭ 5,216 (+375.48%)
Mutual labels:  asyncio, postgresql
FinanceCenter
Fetching Financial Data (US/China)
Stars: ✭ 26 (-97.63%)
Mutual labels:  sqlalchemy, asyncio
Asyncpgsa
A wrapper around asyncpg for use with sqlalchemy
Stars: ✭ 371 (-66.18%)
Mutual labels:  asyncio, sqlalchemy
Databases
Async database support for Python. 🗄
Stars: ✭ 2,602 (+137.19%)
Mutual labels:  asyncio, sqlalchemy
Qb
The database toolkit for go
Stars: ✭ 524 (-52.23%)
Mutual labels:  sqlalchemy, postgresql
Full Stack
Full stack, modern web application generator. Using Flask, PostgreSQL DB, Docker, Swagger, automatic HTTPS and more.
Stars: ✭ 451 (-58.89%)
Mutual labels:  sqlalchemy, postgresql
Piccolo
A fast, user friendly ORM and query builder which supports asyncio.
Stars: ✭ 219 (-80.04%)
Mutual labels:  asyncio, postgresql
Eralchemy
Entity Relation Diagrams generation tool
Stars: ✭ 767 (-30.08%)
Mutual labels:  sqlalchemy, postgresql
Aioodbc
aioodbc - is a library for accessing a ODBC databases from the asyncio
Stars: ✭ 206 (-81.22%)
Mutual labels:  asyncio, postgresql
dvhb-hybrid
A package to mix django and asyncio in one application
Stars: ✭ 45 (-95.9%)
Mutual labels:  sqlalchemy, asyncio
Fastapi Gino Arq Uvicorn
High-performance Async REST API, in Python. FastAPI + GINO + Arq + Uvicorn (w/ Redis and PostgreSQL).
Stars: ✭ 204 (-81.4%)
Mutual labels:  asyncio, postgresql
Sqlalchemy aio
Asyncio strategy for SQLAlchemy.
Stars: ✭ 299 (-72.74%)
Mutual labels:  asyncio, sqlalchemy
Tortoise Orm
Familiar asyncio ORM for python, built with relations in mind
Stars: ✭ 2,558 (+133.18%)
Mutual labels:  asyncio, postgresql
Gino
GINO Is Not ORM - a Python asyncio ORM on SQLAlchemy core.
Stars: ✭ 2,299 (+109.57%)
Mutual labels:  asyncio, sqlalchemy
Enferno
A Python framework based on Flask microframework, with batteries included, and best practices in mind.
Stars: ✭ 385 (-64.9%)
Mutual labels:  sqlalchemy, postgresql
Peewee Async
Asynchronous interface for peewee ORM powered by asyncio
Stars: ✭ 607 (-44.67%)
Mutual labels:  asyncio, postgresql

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: http://docs.python.org/3.4/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.

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].