Skip to main content

Asynchronous library for data source connections, used by Navigator.

Project description

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 (requires aiomcache)
  • 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)
  • mcache: aiomcache (Memcache)
  • 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.

Project details


Release history Release notifications | RSS feed

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.6-cp313-cp313-win_amd64.whl (363.5 kB view details)

Uploaded CPython 3.13Windows x86-64

asyncdb-2.15.6-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (681.9 kB view details)

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

asyncdb-2.15.6-cp313-cp313-macosx_11_0_arm64.whl (374.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

asyncdb-2.15.6-cp313-cp313-macosx_10_13_x86_64.whl (376.8 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

asyncdb-2.15.6-cp312-cp312-win_amd64.whl (363.8 kB view details)

Uploaded CPython 3.12Windows x86-64

asyncdb-2.15.6-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (684.9 kB view details)

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

asyncdb-2.15.6-cp312-cp312-macosx_11_0_arm64.whl (375.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

asyncdb-2.15.6-cp312-cp312-macosx_10_13_x86_64.whl (377.8 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

asyncdb-2.15.6-cp311-cp311-win_amd64.whl (364.2 kB view details)

Uploaded CPython 3.11Windows x86-64

asyncdb-2.15.6-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (688.1 kB view details)

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

asyncdb-2.15.6-cp311-cp311-macosx_11_0_arm64.whl (374.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

asyncdb-2.15.6-cp311-cp311-macosx_10_9_x86_64.whl (376.4 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

asyncdb-2.15.6-cp310-cp310-win_amd64.whl (363.9 kB view details)

Uploaded CPython 3.10Windows x86-64

asyncdb-2.15.6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (655.8 kB view details)

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

asyncdb-2.15.6-cp310-cp310-macosx_11_0_arm64.whl (374.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

asyncdb-2.15.6-cp310-cp310-macosx_10_9_x86_64.whl (376.4 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: asyncdb-2.15.6-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 363.5 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for asyncdb-2.15.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a0bc62512dddae858e2186081909c3401df3c29097427372f28a5b0042547782
MD5 9052fcb5d92934338da898c828a2f722
BLAKE2b-256 90eda4eaaed5e9967c09d3922569bb1165d47782970dc7bc25d1ee4dd2e63489

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.6-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.6-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e967490c98707205a9997153362019f5446da8d19718e8c083321a3c808c05d6
MD5 a99511a77cb51601f6c2225ed6816490
BLAKE2b-256 218e3287eb1eb8a212045bfd0ae549c94e8f6ce9a2341c24e9b70459c957b84e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 121ebc84b7e73e2a6cf6b95715048c1de97a3c41dd877e117dc067c3c80c037c
MD5 d8047de0fbce72637a52ff8fb2e156ad
BLAKE2b-256 f5ed8722516d3aacdb77bcc2b99b7fcc911d872311970864acdcd9ef554b0a10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.6-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 2c47d8110630c3a719ffceadc11799c4c25cb6557af69953b88765718bcff7b4
MD5 de38281f144a235bc0ea021f80ded8ba
BLAKE2b-256 0d86f14bf4c1ae5bb7b0284d019e8c1c0a348ed59a457a81a98fac4ffe220aa3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.6-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 363.8 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for asyncdb-2.15.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1417e0577a21f2f872f67394fe57b34867c0ba26124bb043cdc03f38e3a403a9
MD5 fca1d652f79ec62a6a6a153539f719f0
BLAKE2b-256 38b5d0eaf659eeff6272aa52bd5d96326553b3d51fac99f7a9c67e87e35971f3

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.6-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.6-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 753da6d7f52d8dbbcaf509e234f1d582cae4f7b5560787ee92831c417bbf6d86
MD5 2537ffc9c1aa36a1c9cefc7843220100
BLAKE2b-256 70b7a9c8ebd76665f73a161f0b2e5df7b30f17dd32c29c0c30fc9f237c8cf4e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6fca4a6bc9b40ad34c8b895a1349cb028bc238a3a30a82a2aa792743d9ffdda0
MD5 b545495010cf5950baf4c7b454e705ea
BLAKE2b-256 dde8da44d4dd23b8871adc41dd7aec0f2b8a0be74f8363aa5783eb10b9f6b77b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.6-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 5ced2bffa43784e094190fb2438bc8ff9d6f264cd64678d4d3df8d885e9e596e
MD5 4f54812830e057d684e32e874acea3bb
BLAKE2b-256 5d79077cfc97655ac13bf0b05ea9d41545d2d6f897434bdf512fdadf3208e528

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.6-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 364.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for asyncdb-2.15.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 36a569dda2f801c30a9456caf279ed3cbdd30bed1ae10223ca6955ce44e645fe
MD5 25c6c45efd9f4ebc4d0f66f9280e17e3
BLAKE2b-256 5aedd6bb3373443f4b3edcb0f9ed859b8bfa1123fa81f33766aeb551b8b00409

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.6-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.6-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eeb76618d2592541d12b490f7e21c7c8efc0e2f0dd286a3eeba4e12225f7f7bf
MD5 1d569123ba36b0e9e040e16ee37ff04a
BLAKE2b-256 2e693a93852b90b02ef66b27246289543eaa8543b6a40aa5b7003ff8eda8f841

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2ecf0ef5d7f82a7153f7b4084db9ad319338664c29503c37706d0d66ddb7b960
MD5 122a00fd249cb28c54fdd629ba77dad4
BLAKE2b-256 7ee361013efe0f5d61104763ab97aacfba6b5794ddaf356e96df09a4ff87ccc3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.6-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 375d5850c6bc93a28abf738bf427073e7831e0a249ba6d82101dafe4b3412b9e
MD5 b92770a36b5d0539af08a4960863fc0c
BLAKE2b-256 486442de12d852a9e86adfdfe5b968a47d86683f9b57e20cc44bbaf6c58d05cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.6-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 363.9 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for asyncdb-2.15.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f9da24ada82f152b4b4c37a288e69b1da45eb521892ac4bdf701ca604712165c
MD5 cc6108875c58f52b7c3bcf04a6548c63
BLAKE2b-256 03ec81efd9a5e78c22fcf8dbdeb208761d3245dc83d427718c95092e87fdebf9

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.6-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.6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 25c486a0b2fee6571e64f3a77aa9312e8bcb6da605015f5d88f4b4dd2a0af07f
MD5 a38b9ed327964aaa43da66affd122747
BLAKE2b-256 2d873a8d79852545cced571bc153ace26edb650613465966c7ff3f8045ea186b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1fe35f872bfd54ee810a3cd378a648ba7203f22a9e1ce359c3ec3de86f1b69b9
MD5 433401b63298aa1af2e4dee2f875083c
BLAKE2b-256 7d374aae52fa932896fd0e7e439ccd320ae5e5ed2ed0fe504890829c701ef2ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.6-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c90e93bee795feed5dfeff6cce2359e3f1c8ca8aff82696b03822731f46d3298
MD5 f7ee1c031fa6e1de56ef4861449c7aa6
BLAKE2b-256 484373ac3037112ec1da469734bd766a502a62a5a36c7cc90ab789c8102247b2

See more details on using hashes here.

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