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

Uploaded CPython 3.13Windows x86-64

asyncdb-2.15.8-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (683.0 kB view details)

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

asyncdb-2.15.8-cp313-cp313-macosx_11_0_arm64.whl (375.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

asyncdb-2.15.8-cp313-cp313-macosx_10_13_x86_64.whl (377.9 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

asyncdb-2.15.8-cp312-cp312-win_amd64.whl (364.9 kB view details)

Uploaded CPython 3.12Windows x86-64

asyncdb-2.15.8-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (686.0 kB view details)

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

asyncdb-2.15.8-cp312-cp312-macosx_11_0_arm64.whl (377.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

asyncdb-2.15.8-cp312-cp312-macosx_10_13_x86_64.whl (378.9 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

asyncdb-2.15.8-cp311-cp311-win_amd64.whl (365.3 kB view details)

Uploaded CPython 3.11Windows x86-64

asyncdb-2.15.8-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (689.2 kB view details)

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

asyncdb-2.15.8-cp311-cp311-macosx_11_0_arm64.whl (375.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

asyncdb-2.15.8-cp311-cp311-macosx_10_9_x86_64.whl (377.5 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

asyncdb-2.15.8-cp310-cp310-win_amd64.whl (364.9 kB view details)

Uploaded CPython 3.10Windows x86-64

asyncdb-2.15.8-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (656.9 kB view details)

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

asyncdb-2.15.8-cp310-cp310-macosx_11_0_arm64.whl (375.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

asyncdb-2.15.8-cp310-cp310-macosx_10_9_x86_64.whl (377.5 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for asyncdb-2.15.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 069daf00fcefc222c3fe025c5d171738ea931ec1c047e2eb67cfbbd92f0b6c23
MD5 a9a0d4d67c0e42ae3f71373f30ac5622
BLAKE2b-256 c684628d908212c5a5f951194d97f21a5723c984bb091d04e0fb74604f20b0bb

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.8-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.8-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 574a5a763f5926997cf895155942963a691465824bce1cc6babcf67f80aa79ea
MD5 077ea2075e20435459af31af35ea4117
BLAKE2b-256 e30538aef89f6c2f138b995870fae95849f24bdc1bcc7025fc4935ae18b7fa25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.8-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a1349d0de6d1f5527de19476959e31a793eac881d960b7617add48cb2e27d5f7
MD5 2d094f15b524fbc0b4ebe0082a4f7ed8
BLAKE2b-256 b471b2eb30df1371bf6ad1aa01322efb49ae4df4f0d6d7cff3a355fc3aaabff1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.8-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 08f11174bbe91f22dd4cea02780b2d65787700a4d50cb0f0c86c2863e7a94188
MD5 bb7e37693c90b70d150761268a09d583
BLAKE2b-256 64ec295dd3ba44c57945ec09933f00e2c5cd4d2924a27ff102e3a20863f66928

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asyncdb-2.15.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ebc1c1f23496004a9b7c398797cfa4a314d85f1d606b13a4a1fab05b455abf62
MD5 c819b9ec99176cf93d07ec18571806d3
BLAKE2b-256 2487983e5dafa30eada271f60194f587ea5575e05eb9dd77db9eafe137cef031

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.8-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.8-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7aa5672bd8ae34a036e05e38a69cda57e6098ebcbc3fa7eac51e4ffe58880f94
MD5 c4cd52cb114c6b822c88cb2afc74d02c
BLAKE2b-256 75512fabadf0662ce8f03f449dcd3dca1b441ff946a27833d0dce48947a3510c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.8-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f724fbb25366d4e77f52cbfd6666d869737faf49aa42f87794f55ee35f9a0aef
MD5 70321768cc8647e93300fb036a4241ef
BLAKE2b-256 78101e8fc3b5124b61a4884c2ee17e1a92294d4d3f6de710e7fe411e91bbe722

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.8-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 fe1b4d20037b45e45c5f9b25c1e4f8072dc7fd8bfeccd0bdfdbe76d7d1d221fa
MD5 754a14260df4a3d31f77fc5a8bf763a2
BLAKE2b-256 5080a325e3d593ed16a310d5df3c4651e45f540124a9ec7aa9a3eed6e4e6a59c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asyncdb-2.15.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 349384d2dae621ead0916cb70f91f87aee5a5bb308e64364a4f169acdc315cde
MD5 9dc65d2b7e01a85af61cecb25127b8e0
BLAKE2b-256 47fefb38f3ec7fa1c690ca244b2e0cd8999e03461b494b523c014de4e537ec3c

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.8-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.8-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ef9eb035853ae9c634b54f759283ce7884a71a6fb80ec0bb6836b65ca7a6773c
MD5 34187a70028223329bd1977afe129d30
BLAKE2b-256 bcead5c321368fc9c6cff43585a1a850ea656cd4f2239b7470832eedbb467d97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.8-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c82ac16435113fc640386b552b4ec488d957d63b9b71a12a03114004408463c5
MD5 b775b710f7e19331827331a73281e85b
BLAKE2b-256 9806db299629b504405d00471b16eb1eb392865a4e120d1512713db823a5f751

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.8-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c5f8cd568bd82065f9abc904cd0a7613c81aca65cb6baeebc835ed55ee1e7ff4
MD5 6f9aff00cace33a91a057bc83a1d4263
BLAKE2b-256 efeed94152d02e064a8bdb734369062d2c509373b3bbafbf5014287371af07fd

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asyncdb-2.15.8-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e74408659a582ff703df57e506462a8121a9a3226a9a2618b1f052c90a59e78e
MD5 da3123cac9169769779bc6aca7acaa91
BLAKE2b-256 0487a82ac45830af54c5aa3ccd008158501d8182754b76a60cd0ea8d86121eb0

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.8-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.8-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7c87497342c90eca49205c9e32be84aadd71adac3304e35f11cf4938f2de6398
MD5 f06fbfc78a219c4f85724bd166b4e4ef
BLAKE2b-256 f72f758a052d195eb70d7d4727ad0b11e4e9b5e30135224217e7fd760f34f16f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.8-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9806a9c152c0beae090a3ea36414856f5d43b9120a2e3e259ea970fe76ec3500
MD5 770db5e4acae753d03d07e247315f2a3
BLAKE2b-256 d03219451c7c333fad5baaaa028fb48ae3a8df755a520377baf41a27bf32c788

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.8-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ad6666598d860d6dbc58a975648ed0563d7de773f9fa373ccc003393530b7790
MD5 6c3d9aded7a5da35fb7184d5c1ca904e
BLAKE2b-256 59a0787412be7bb7c5120ea0e97157fd84cad8f48e80217bcc0d75ae8e9999ea

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