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

Uploaded CPython 3.13Windows x86-64

asyncdb-2.15.7-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (682.1 kB view details)

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

asyncdb-2.15.7-cp313-cp313-macosx_11_0_arm64.whl (374.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

asyncdb-2.15.7-cp313-cp313-macosx_10_13_x86_64.whl (377.1 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

asyncdb-2.15.7-cp312-cp312-win_amd64.whl (364.1 kB view details)

Uploaded CPython 3.12Windows x86-64

asyncdb-2.15.7-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (685.2 kB view details)

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

asyncdb-2.15.7-cp312-cp312-macosx_11_0_arm64.whl (376.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

asyncdb-2.15.7-cp312-cp312-macosx_10_13_x86_64.whl (378.1 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

asyncdb-2.15.7-cp311-cp311-win_amd64.whl (364.5 kB view details)

Uploaded CPython 3.11Windows x86-64

asyncdb-2.15.7-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (688.4 kB view details)

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

asyncdb-2.15.7-cp311-cp311-macosx_11_0_arm64.whl (374.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

asyncdb-2.15.7-cp311-cp311-macosx_10_9_x86_64.whl (376.6 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

asyncdb-2.15.7-cp310-cp310-win_amd64.whl (364.1 kB view details)

Uploaded CPython 3.10Windows x86-64

asyncdb-2.15.7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (656.1 kB view details)

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

asyncdb-2.15.7-cp310-cp310-macosx_11_0_arm64.whl (374.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

asyncdb-2.15.7-cp310-cp310-macosx_10_9_x86_64.whl (376.6 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: asyncdb-2.15.7-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 363.7 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.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3a32d0d7c6e29417e0cc17c04fd6a2cea9ec88ff4c5393fdb7ad7718cbe74360
MD5 37de171aed7767bf747a7e366fa7fa73
BLAKE2b-256 b03fbadfa6e2eff1fae6dab24e8fa58a907ac9a8bcedc1dd7daf5ed90632770c

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.7-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.7-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d8911bdfdc644e421a9d271a4715ae4918b3d28bcef2530b10dafb0f5fa0743c
MD5 bd7822126e4410de1330423c83cc2936
BLAKE2b-256 d512740568a4ceb599e22d9254852b3b3c8f94e13687646da59d413c8c4e3478

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 295ae311b1804a1cdc97836ca48fb0f79710c336e37fb7043cad8c60a41132b2
MD5 863c9f2ed38f56a36da808f85f474e27
BLAKE2b-256 6be6ea1cb36fb7a20b4597745f98928f4371843a014ca6aca105319a54c2cd80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.7-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 edb19e13d38c6e3f1ba7d3127e48f3fcbe39faaefff7245c9d6da86ebfa0015b
MD5 4decb2a8cec00410bfee00583636692e
BLAKE2b-256 e9d75ed1a4c0b53996e8fc3b896f98ac5b9096053dd7f05b1f9f6d3c1683d5dc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.7-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 364.1 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.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fd9ec0674d9032831ddc25e5470d03057b5467179ac378b2f34be4d1e8183ba0
MD5 0bc454f83b57be030503cdf2d7081666
BLAKE2b-256 2cc74c0f245bfd8b16ae7ffc56c3019437ed2dea1b7c321d0a3e20311e625878

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.7-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.7-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3b804ecac70993f68adfe79905b7e64b81f39e87da3472a456912fd17e0e05d9
MD5 31d7e8beaba1588adfea284ab0ef36e0
BLAKE2b-256 2cbdc7da2fc9e29910f0c798c06e2bac16ec97f47c622615d358b1d701acafbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fefc36523350e4b908cb72d21704f45486c41b034bc3c8e8b145bfcfbd5552cc
MD5 222e01fd0e678ec13c049078536e8e76
BLAKE2b-256 6d6076699e0ddd32d29d79b2dc3b0b898889a4fb94a2c801060d9e6c4f72273e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.7-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 098a01fe99c0224131cd5c89ba1b6d496f1a18f8b77ba47587b0e849265f47e1
MD5 038def0405053ae0195e14e4f88435c4
BLAKE2b-256 f5ef4db392de4255bd549ca48f2cdeadfd3636b3a754c75c0a3e2dd5cbdcd8ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.7-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 364.5 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.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cbc8da2cff82b3cb3f1d8924ab15afb7eba370440990351db576d446eacbac1f
MD5 e10056eda19d691807966f4879992f2b
BLAKE2b-256 9ad8d8fab779d36c66f7c76afd95420a89e77a7279d3676865e4e2fb966c7875

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.7-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.7-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f6e4d7cf888bb13c0a25f9f55f4e401befa0cc691bc27ae4119ed3700c57c1fc
MD5 cf22dfa8b4c85bb554d6c228c3e33acd
BLAKE2b-256 14bf40fde55af92e14a809221ccb5a933f00fca926a009510b2955694311a201

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6fb7ed09492771cf1f21e4c587767018b88d09dbe006a83af443249fe4c68588
MD5 b2b3611cf1a19c831affc9699850bd27
BLAKE2b-256 2b31712e08a24053860adb1d57b3ff6e1281ddf197477768a4e5ed7ad80f7072

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.7-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4b93ca45570f3fc9fb642cb0c455866ac1333b0d4a34e8fe4e60c247f072a31b
MD5 c9c98f305f79b01529cbadd194335f50
BLAKE2b-256 687d70a23923a38c2f4cd9ee9ffe5ce87f83acfd570234cbd255dc55068c2105

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.7-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 364.1 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.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0c168187d4a0db67d5b42c17bf93b7c36f5631bae55a30b375913f6f7ddd8259
MD5 e744967f4a5b2031c59f4ecd3d2f5d5d
BLAKE2b-256 4da3248bd4982460559a1ff7024645a01726761e6ad54acf9971d78048b17bf2

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.7-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.7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d69e483e5cd5b84ec69ec711296cfce59ac5520fb63e8f3cc9a49798dd776182
MD5 e1fe14b2686c0843d1b296249bf2b7fa
BLAKE2b-256 28d8a93b1fca32108e921d3c24835795b63693c403b6d724a522aa1ce10c9f75

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8eecb15e596978940e7470668eed79b7e3dd2f2cc29bfd4f92b965d6ae78ebe3
MD5 1f2a7d2688493baf2828ca1525912527
BLAKE2b-256 565555eff465ebb021dbabd63fc6afb9b795619fd9f2ecf6881845036e5700fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.7-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2d2661351d41e43a0f57ba87c6e508f07776dc896e29de2475001049313ebff8
MD5 aeb9f1cd4ceaf2a6f0dc4c482d1503b7
BLAKE2b-256 82e7783e5c615dd5fae0810370a508cbcb438e2e773bc7383b5dc52bbd2d0dba

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