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

Uploaded CPython 3.13Windows x86-64

asyncdb-2.15.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (672.4 kB view details)

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

asyncdb-2.15.2-cp313-cp313-macosx_11_0_arm64.whl (365.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

asyncdb-2.15.2-cp313-cp313-macosx_10_13_x86_64.whl (367.3 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

asyncdb-2.15.2-cp312-cp312-win_amd64.whl (354.2 kB view details)

Uploaded CPython 3.12Windows x86-64

asyncdb-2.15.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (675.4 kB view details)

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

asyncdb-2.15.2-cp312-cp312-macosx_11_0_arm64.whl (366.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

asyncdb-2.15.2-cp312-cp312-macosx_10_13_x86_64.whl (368.3 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

asyncdb-2.15.2-cp311-cp311-win_amd64.whl (354.6 kB view details)

Uploaded CPython 3.11Windows x86-64

asyncdb-2.15.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (678.6 kB view details)

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

asyncdb-2.15.2-cp311-cp311-macosx_11_0_arm64.whl (364.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

asyncdb-2.15.2-cp311-cp311-macosx_10_9_x86_64.whl (366.9 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

asyncdb-2.15.2-cp310-cp310-win_amd64.whl (354.3 kB view details)

Uploaded CPython 3.10Windows x86-64

asyncdb-2.15.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (646.3 kB view details)

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

asyncdb-2.15.2-cp310-cp310-macosx_11_0_arm64.whl (364.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

asyncdb-2.15.2-cp310-cp310-macosx_10_9_x86_64.whl (366.9 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: asyncdb-2.15.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 353.9 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.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7a23c39efc5e209be716866eba589938c2c2ab387c2c48a46326d31302a786a8
MD5 d9e6748d1aae78e9ceb20e53d0dd03c2
BLAKE2b-256 a635c53bf71f4cf81a40d2908a767e032a24f80d4181ac93ecf5c231df781134

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.2-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.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 386adc0a2f69e3bd404aa6aa4cdbd57fce6344de7344c2a74cb521a16f0588a9
MD5 8fb32994cc2a7f53c8048b592a3ae80f
BLAKE2b-256 218e1d3c00dc6dcc9ff6444927c30f37d8995e8c39da764b90c723b036154850

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 04c7ba0f3ed35023765a8807622a2c44c7fea3d1f6261aec6a963740b689418c
MD5 0da2e5ece956e78f3e60bd055b116778
BLAKE2b-256 6af2380ed8fe94610024bd404b97a6377f99627c959b8ba295eec96bbd4606d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.2-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 8409df486b6b547fa2bcbf7b3ba9ac4a1dc8b6025a2fdeacfe3fc0afca29f663
MD5 e83ae143c7b83f3400f4c043be7a3db5
BLAKE2b-256 7efc4ceb82bd279682ec800e03a61f250a28182469b821f419b41f1e7d9a8417

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 354.2 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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0476600776c3d78c5684502cc19d341bde189196b2975b6885eb6177a78bf93e
MD5 27e24220bfa44089ced1af9e568c2d09
BLAKE2b-256 6c0b8a13f668e5c0227b4e5b8c3aa9076032456071b21a46990cbe893d4d700d

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.2-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.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b65ddc3e43807ac57afab0fdb38c72c7a3195a0225ca243df3103b19707c85f2
MD5 505f22f02b1819bded1295b3274a5f7d
BLAKE2b-256 cadeb76359102fffc7d9172d3f005d7a09d1e272a2ac90b2a0590e68fe1aa0c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 20dcdce99a41cf81f8d658fbb4c0cc28f92cfc859c05b76690ab81326050970c
MD5 0a14feee46ad0c6bbc054888809a8511
BLAKE2b-256 0540395c4d514b4bf0cbae9aeed91ea0c35e214becaacf2810c48ab38d93698c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.2-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 33f79f2daf54ed304106da437f7f042889f3267a535752ee7704df2a7192575d
MD5 7d57bb785dd5d576a33e8aa003f72016
BLAKE2b-256 2cbe711180218c2a93c07742f0523532845a7b88c5cac394f06121f040136540

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 354.6 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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2fbe0066c8b17814ecb9b57321d3964cf933a34e2f3b0e477bdf9f79cd26722c
MD5 c83c94961f7e8f4efcfe10c2f47913cc
BLAKE2b-256 ffc58ec7d0a7b2b5be6aac6ff282ec8ebaf27693c51df0e1d546349e2f2d2420

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.2-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.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f5c7298b9f59b6bfd2f421d38492604ceee7fff8369be4cdeb19016b09405b3
MD5 fcb8be32a923dbe431be28cddd56fa62
BLAKE2b-256 d2fc42d634635feb6366c1ea07261a5d818d6450925dcee3663c0e496b213bc8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a04c7f819484fa21c32d90aa6d3589cddee79e64092788580124ba443287b5c1
MD5 46b8fc379c884bf6795b2cf872fb17e4
BLAKE2b-256 8a5f48086c142f7685d4d2d37e7d4483bc0ebf1c312a2e625438696d9ffc8b30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 84189325916bd3521ff971162e3993902f1b2d175f84155b960512bba2e3a00e
MD5 41ef9f60f048ab02ba8b1601e0743494
BLAKE2b-256 6678cdf702bcd03c5e372cbc9667e523b85a6253f6edeb1b8a0b973a118007b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 354.3 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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a04cae9625ae1d0303e2c2149361093de6514824ae1bac3d1e38f0904b86c8df
MD5 4b0c75ebb6384283f46b5c7afc6ee261
BLAKE2b-256 d9dfe073fe97b07d7269d98a0f48e3fb2e400b5f47eacf1c1ede5806fb8ee39b

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.2-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.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e7e01e4044358595e1893f3a5cea936b4608ab67e5e6bb62a70da5f63b6f1414
MD5 a27be477ff537c4390c903d12ee93da3
BLAKE2b-256 7a6c62ee57ccea481c5a2059524e74d63e866c72b33cea590c5752a715b78958

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c4b4e913e8867cb40d336dc7eae26a32c816ade556574cd2980d8db29e33de35
MD5 38baccb9bf8137a55991e8f002471ae0
BLAKE2b-256 9253edbd549391daf0a0d3afda85dcd9829d14536876be1dd1c11b99a0229ad3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b4c16f3b9cf706dc8985fb58af2e223fff70677a95e455916b5500036aa4f077
MD5 aa16395091d7a832d638cd9079002251
BLAKE2b-256 1ecfb39f4e609ccfff6802f02929bbd2f15c5c2c0ae9ac0cb33e53c38c413be1

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