Skip to main content

AsyncDB

AsyncDB is a collection of different Database Drivers using asyncio-based connections and binary connectors (as asyncpg) but providing an abstraction layer to easily connect to different data sources, a high-level abstraction layer for various non-blocking database connectors, on other blocking connectors (like MS SQL Server) we are using ThreadPoolExecutors to run in a non-blocking manner.

Why AsyncDB?

The finality of AsyncDB is to provide us with a subset of drivers (connectors) for accessing different databases and data sources for data interaction. The main goal of AsyncDB is to use asyncio-based technologies.

Getting Started

Requirements

Python 3.9+

Installation

$ pip install asyncdb
---> 100%
Successfully installed asyncdb

Can also install only drivers required like:

$ pip install asyncdb[pg] # this install only asyncpg

Or install all supported drivers as:

$ pip install asyncdb[all]

Requirements

Currently AsyncDB supports the following databases:

  • PostgreSQL (supporting two different connectors: asyncpg or aiopg)
  • SQLite (requires aiosqlite)
  • mySQL/MariaDB (requires aiomysql and mysqlclient)
  • ODBC (using aioodbc)
  • JDBC(using JayDeBeApi and JPype)
  • RethinkDB (requires rethinkdb)
  • Redis (requires aioredis)
  • Memcache (optional, requires aiomcache: pip install asyncdb[memcache])
  • MS SQL Server (non-asyncio using freeTDS and pymssql)
  • Apache Cassandra (requires official cassandra driver)
  • InfluxDB (using influxdb)
  • CouchBase (using aiocouch)
  • MongoDB (using motor and pymongo)
  • SQLAlchemy (requires sqlalchemy async (+3.14))
  • Oracle (requires oracledb)
  • Redpanda (Kafka-compatible, requires aiokafka)

Quick Tutorial

from asyncdb import AsyncDB

db = AsyncDB('pg', dsn='postgres://user:password@localhost:5432/database')

# Or you can also passing a dictionary with parameters like:
params = {
    "user": "user",
    "password": "password",
    "host": "localhost",
    "port": "5432",
    "database": "database",
    "DEBUG": True,
}
db = AsyncDB('pg', params=params)

async with await db.connection() as conn:
    result, error = await conn.query('SELECT * FROM test')

And that's it!, we are using the same methods on all drivers, maintaining a consistent interface between all of them, facilitating the re-use of the same code for different databases.

Every Driver has a simple name to call it:

  • pg: AsyncPG (PostgreSQL)
  • postgres: aiopg (PostgreSQL)
  • mysql: aiomysql (mySQL)
  • influx: influxdb (InfluxDB)
  • redis: redis-py (Redis)
  • memcache: aiomcache (Memcache, async, no system libraries required)
  • odbc: aiodbc (ODBC)
  • oracle: oracle (oracledb)
  • redpanda: Redpanda/Kafka (aiokafka)

Output Support

With Output Support results can be returned into a wide-range of variants:

from datamodel import BaseModel

class Point(BaseModel):
    col1: list
    col2: list
    col3: list

db = AsyncDB('pg', dsn='postgres://user:password@localhost:5432/database')
async with await d.connection() as conn:
    # changing output format to Pandas:
    conn.output_format('pandas')  # change output format to pandas
    result, error = await conn.query('SELECT * FROM test')
    conn.output_format('csv')  # change output format to CSV
    result, _ = await conn.query('SELECT TEST')
    conn.output_format('dataclass', model=Point)  # change output format to Dataclass Model
    result, _ = await conn.query('SELECT * FROM test')

Currently AsyncDB supports the following Output Formats:

  • CSV (comma-separated or parametrized)
  • JSON (using orjson)
  • iterable (returns a generator)
  • Recordset (Internal meta-Object for list of Records)
  • Pandas (a pandas Dataframe)
  • Datatable (Dt Dataframe)
  • Dataclass (exporting data to a dataclass with -optionally- passing Dataclass instance)
  • PySpark Dataframe

And others to come:

  • Apache Arrow (using pyarrow)
  • Polars (Using Python polars)
  • Dask Dataframe

Contribution guidelines

Please have a look at the Contribution Guide

  • Writing tests
  • Code review

Who do I talk to?

  • Repo owner or admin
  • Other community or team contact

License

AsyncDB is copyright of Jesus Lara (https://phenobarbital.info) and is licensed under BSD. I am providing code in this repository under an open source licenses, remember, this is my personal repository; the license that you receive is from me and not from my employeer.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

asyncdb-2.15.10-cp313-cp313-win_amd64.whl (252.3 kB view details)

Uploaded CPython 3.13Windows x86-64

asyncdb-2.15.10-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (570.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

asyncdb-2.15.10-cp313-cp313-macosx_11_0_arm64.whl (264.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

asyncdb-2.15.10-cp313-cp313-macosx_10_13_x86_64.whl (265.6 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

asyncdb-2.15.10-cp312-cp312-win_amd64.whl (252.5 kB view details)

Uploaded CPython 3.12Windows x86-64

asyncdb-2.15.10-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (573.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

asyncdb-2.15.10-cp312-cp312-macosx_11_0_arm64.whl (265.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

asyncdb-2.15.10-cp312-cp312-macosx_10_13_x86_64.whl (266.6 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

asyncdb-2.15.10-cp311-cp311-win_amd64.whl (252.9 kB view details)

Uploaded CPython 3.11Windows x86-64

asyncdb-2.15.10-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (577.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

asyncdb-2.15.10-cp311-cp311-macosx_11_0_arm64.whl (264.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

asyncdb-2.15.10-cp311-cp311-macosx_10_9_x86_64.whl (265.3 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

asyncdb-2.15.10-cp310-cp310-win_amd64.whl (252.4 kB view details)

Uploaded CPython 3.10Windows x86-64

asyncdb-2.15.10-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (544.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

asyncdb-2.15.10-cp310-cp310-macosx_11_0_arm64.whl (264.3 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

asyncdb-2.15.10-cp310-cp310-macosx_10_9_x86_64.whl (265.2 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file asyncdb-2.15.10-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: asyncdb-2.15.10-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 252.3 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for asyncdb-2.15.10-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b12364decfd9bf3a612fe46dbf67eba84900e69347c18f63a6c9de7f055af332
MD5 a0ca83d03a4835fb05352ec0c8ba6378
BLAKE2b-256 fdfd78c5d3fdf44238d5d61f12560cc295b46bb1023b3d60cfe0375551d04cdc

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for asyncdb-2.15.10-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8697fb285ce2e01719e56e939c3efc2055b8f59255a6ca39fc7f0fcb03df3f5d
MD5 b36d9daf2ba0f7655edab5d5e3829af3
BLAKE2b-256 68bfdd9aff45da9e503c4dfc8b16d853a24c2af5a23f230d63ec1979fdd93828

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for asyncdb-2.15.10-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a7d1fcec172f9875f1ad28bd655c651cfc150798152a7a76c5a4efcf95a1fc0e
MD5 930015cb8d89c2c16ea9fc7fdc3b250d
BLAKE2b-256 c65ee7118a8d16cc5bd25d3b2934c1955f39055b1b195bd7d50815642c4f3959

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for asyncdb-2.15.10-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 841f84f934072d6b6a8f26c3739957008bde48b72b0655aa6e339583cbb97858
MD5 0b2fcb0a096508c8be6eafb5d4d5f6c2
BLAKE2b-256 ebf831334d9be091269d54d4fb2e400296ef50bd7364246b5acbd7b5161bdeb2

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: asyncdb-2.15.10-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 252.5 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for asyncdb-2.15.10-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 844c92d73bbf19bd28e1de2cca2b69872ae9d7667178e8df40a959c3d1b78d36
MD5 6dbf9f43d5ba8998c56756fbbdc3d314
BLAKE2b-256 622b2d5451f519a6e50f262fad4de83367777338eb51c668bf327b43c7f5d703

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for asyncdb-2.15.10-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 147edc02acba205f729db47878083dc4d8023d2b14d8ecaed92e3e0c9682e66e
MD5 b0b32b19b558c97d8fb858703c1cc098
BLAKE2b-256 d882aacfba5fc7f084c50b51b10ec4e7811e6f27f4a91bcc533717200a69540e

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for asyncdb-2.15.10-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e08a0be87f60d6df6bf98c09cd35b0012582594a0eff87bbd23d3a12b8a23346
MD5 be9ce05228da143843c1924397ae6103
BLAKE2b-256 71fa374135939e57e9da5ee6fc0178b59ad65b179ada700e5418e24a74233b98

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for asyncdb-2.15.10-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 541643107397274e19684b8be0ab927742ed0a80224cfe324688abd01eacc85e
MD5 a7a820b9ac8f0238d0cd07a008b1a451
BLAKE2b-256 fe60976de53cf662c70afb437ea2ae9c50ee5f5da5082d9c3f3924ce711a2873

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: asyncdb-2.15.10-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 252.9 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for asyncdb-2.15.10-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ae4ed7c0ed11b3bf633e3f56eabea4027e78ae588eab971eb971b6716d7c509e
MD5 b73508d2d096004d6a8744390e63b984
BLAKE2b-256 5619a1768fb04cf704cb205b06d0ad40ec63a4913b9474ec59067bd9126449af

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for asyncdb-2.15.10-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 06fdcd4e5ce68b8ba29e815d0700c4ac0b5440bb87e34fef1711534eca530e89
MD5 fbd8e76cf03ed21eddfa3104dd8dc18f
BLAKE2b-256 192fa16c1fe19b8bc4b58015ba23d78505068b5f6345bc0ea2c6289eef086455

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for asyncdb-2.15.10-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3035e4d047b78c34f706fcdf62357acc5956d8d7dc0c9290e8717cff7bff3dea
MD5 3a8d14617ef22d6471973c5d3c6db8b1
BLAKE2b-256 163128ce541b77ed6868aabf84552bcd88ad710798fc538004b4067624d400f5

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for asyncdb-2.15.10-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 86e7c823504057b5fce32afb566479bc3c27d96a8ab4efd23a1b03d392cf1539
MD5 a0c1b4678fdcc6582552a8681ffc9060
BLAKE2b-256 ddece24111139a83e5a64a22a49e59fe0d26a014e5061c7807b69bf5603a041d

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: asyncdb-2.15.10-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 252.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for asyncdb-2.15.10-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 134f156786a2fd45e4a7a1b745089ecc5e64e850c02d1b7a0734913fc490d708
MD5 6bdadefbdcdabf6cf381a71f9a76f857
BLAKE2b-256 321d2ab080685f9f323fe9f6024de365efdb627361d8ddeb391049d35ef6cd4c

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for asyncdb-2.15.10-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 82559023e8ed8273d2e4b3acc71474b5c86874e16f77a227d32c674c6837a1f9
MD5 5c3c864e819aa06bf0796ce67ee882d1
BLAKE2b-256 7a07ea3d5dcb1c933b2e7c16c08aa61dc3a11d0e417267304e707d74c3d1e73f

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for asyncdb-2.15.10-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0243de3de9968d9509e10fbb83fd03386aba32c20f4e736cd6070636e3e0d3dc
MD5 5c245b1e8ad373567056d371c1bf9188
BLAKE2b-256 d3c44a5cf842da005be968b10c668e0eb82069be1fb07142fad33cf590b3e382

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.10-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for asyncdb-2.15.10-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d84b238801c935811dafe7ff320f74333e08d7defe5d3f171e1c6ab08941c026
MD5 c77049cc69006663e346f7becbe87cc5
BLAKE2b-256 b88524c04dd0879f9bfcf9aa1c946d43832557234afbdca4c1224e036dba8c3e

See more details on using hashes here.

Release history Release notifications | RSS feed

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page