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

Uploaded CPython 3.13Windows x86-64

asyncdb-2.15.4-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (681.8 kB view details)

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

asyncdb-2.15.4-cp313-cp313-macosx_11_0_arm64.whl (374.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

asyncdb-2.15.4-cp313-cp313-macosx_10_13_x86_64.whl (376.7 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

asyncdb-2.15.4-cp312-cp312-win_amd64.whl (363.7 kB view details)

Uploaded CPython 3.12Windows x86-64

asyncdb-2.15.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (684.8 kB view details)

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

asyncdb-2.15.4-cp312-cp312-macosx_11_0_arm64.whl (375.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

asyncdb-2.15.4-cp312-cp312-macosx_10_13_x86_64.whl (377.7 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

asyncdb-2.15.4-cp311-cp311-win_amd64.whl (364.1 kB view details)

Uploaded CPython 3.11Windows x86-64

asyncdb-2.15.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (688.0 kB view details)

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

asyncdb-2.15.4-cp311-cp311-macosx_11_0_arm64.whl (374.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

asyncdb-2.15.4-cp311-cp311-macosx_10_9_x86_64.whl (376.3 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

asyncdb-2.15.4-cp310-cp310-win_amd64.whl (363.8 kB view details)

Uploaded CPython 3.10Windows x86-64

asyncdb-2.15.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (655.7 kB view details)

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

asyncdb-2.15.4-cp310-cp310-macosx_11_0_arm64.whl (374.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

asyncdb-2.15.4-cp310-cp310-macosx_10_9_x86_64.whl (376.3 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: asyncdb-2.15.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 363.4 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.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 de47fa5f414c568f6b9bbedafacc862e0db54e188607fa3dbde21791fc38e6cf
MD5 aa849c2d776c25df6569cd686ed60ed3
BLAKE2b-256 cd68757678bb4cc208a982fce3a6b45a163df7e25094d9335b1e23b12318e2f9

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.4-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.4-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c7a8035e458baecc5c7d61cf676a36a88167dd85749483b5f64013e86da8d86f
MD5 b9e8b829400ffd680c65a447f407fb2e
BLAKE2b-256 0ba23adaa7044d13152acfeab58636a1a67f6655818fc2e1fa33308e8c81c7ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4dc1495aa3c37b396b1950692dbc310fbcc94b1bd55254e003ac75ba25d04828
MD5 4ea1c6f7019686ec4f5f76be6957ff0a
BLAKE2b-256 c3e38a8bb6da04d06401689ead1c8cf99c26e8892fcb18dc5feb41deb514ed59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.4-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 0ecc56b8474c88fd94056ce47141b357ed339b247d141f48acfbdd6494d5a3c4
MD5 32fa3e912912f32b380d22e40966e204
BLAKE2b-256 598da37a06b8f7f45303f07f301961ec8a49b275417643dcb9992fe92a4830f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 363.7 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.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 247bc4f6ade1b1e5bbaaa29a4684ab4b4b10939ee11856a3f553242fc6cf874a
MD5 fcbb2b39e9f1c158344216240a7b3938
BLAKE2b-256 9b95f83f8280a04756e83c520a30043acec0364cddb105f4634013de8e77255d

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.4-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.4-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6e3183eb230a0176fb805cd522d038691ad00e742ea381a9a143949a36012d1b
MD5 1378026e86c099c6fb3057335a02f406
BLAKE2b-256 f8f566c81a4fd29d78db9d09e5a9fabc9cfa029733b09b6de94216f2ad6b94ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a246e191d24f5c437c670f0f658a13691f38de27c333598e7fe3e9b9cb2f6103
MD5 bee336d53797a1915ba0f549aa708dbb
BLAKE2b-256 15d56f0d655cfeeb8c011d1912ce78d9b7441f9850ca1696b51a875bec5e3451

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.4-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f11922f2a7e45c265fa04e446dafd7f17c2a3b0de491a14f791764d20a4a0bd4
MD5 d79064e2d9f64f9ada84d2ff7e565957
BLAKE2b-256 735aa325afb699ba2458abc037b124cd728f817c19643fb1b36b8650c23a2d36

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 364.1 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.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4cb7a057ae7a053b56e6d120fe09fd728b4f87a01964927124f2c07106f0cc1b
MD5 4a524ce9ed6ca00e3b7e1c7104a21a23
BLAKE2b-256 886d262f934d2de4cb46e3de0865950317f211049d23c0392c7ebd3370ef6331

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.4-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.4-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d375c9074f2903bc31ff4dc109edf72d9268acfb5a54c726c2a9f32a143f7b47
MD5 038237df3b04a5e42e9d3617530f0c92
BLAKE2b-256 4749595c80eb7100940148d8bc0bc1b9fe6f8e475a00bc087df929800a7dce4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2493d94c463415fc18a210b28e82f9121ce527fbdb2802a78ab7995e48abfc83
MD5 10e2f9d72c715c0c6845cdca0f9ef871
BLAKE2b-256 7c7cfd556d25a261ea91147c85e14a1411d99cfcd095e14c042e442be63d08c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.4-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 cee9bf7cd27522ad731654a28157bcfb66fe33cd1c7aaef0277a19fa2e4f2f5e
MD5 ff1fae31978fdb7ea27892c280ba07c7
BLAKE2b-256 890e6acd917ad68224e8e85201d4fc40621c6e814a00c59581aa8a81ea7451b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 363.8 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.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f3960228db92a3d97881cae4493cf275f8f87f0438c0f93f03ea6ab9fa7b78a7
MD5 63a5be4ea7db51020887dac3b8e3cdab
BLAKE2b-256 fbb63d2157cc5404646b7662effd1973254d3e01bdecb2157ec5cf46d84063c4

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.4-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.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 19c9669247b047ec67b70568aa2faa13aa79f644e376fefda828252b2f2d12fc
MD5 f00cc94ce76a5d171bd43c853655fff8
BLAKE2b-256 5a62f6ca2d8a2265f7272594aff0f6307173af0878a74b7a15fcd65eed64f3da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 95dd4b934b314216ea4f70adef3811dd2f0e187bdb52601c712c1ae757089e91
MD5 f086310ffa5c1fba1184deab4aa825f6
BLAKE2b-256 5c07dd4e73b0daf7e01f30f7f8a1272178467b54f2a7624c8f072fa4f56d0c14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 44b759c4516b44375da68a14294e8bce8d0e2651145972299b2e787eb7ee650c
MD5 56fdfff7c687c8d7d9469fae0d4f3080
BLAKE2b-256 511383e747f0c7db73ebc90d6e14b4c099065c78a0279cb62d7ecb9fc340eaae

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