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

Uploaded CPython 3.13Windows x86-64

asyncdb-2.15.0-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.0-cp313-cp313-macosx_11_0_arm64.whl (365.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

asyncdb-2.15.0-cp313-cp313-macosx_10_13_x86_64.whl (367.4 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

asyncdb-2.15.0-cp312-cp312-win_amd64.whl (354.3 kB view details)

Uploaded CPython 3.12Windows x86-64

asyncdb-2.15.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (675.5 kB view details)

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

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

Uploaded CPython 3.12macOS 11.0+ ARM64

asyncdb-2.15.0-cp312-cp312-macosx_10_13_x86_64.whl (368.4 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

asyncdb-2.15.0-cp311-cp311-win_amd64.whl (354.7 kB view details)

Uploaded CPython 3.11Windows x86-64

asyncdb-2.15.0-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.0-cp311-cp311-macosx_11_0_arm64.whl (364.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 10.9+ x86-64

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

Uploaded CPython 3.10Windows x86-64

asyncdb-2.15.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (646.4 kB view details)

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

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

Uploaded CPython 3.10macOS 11.0+ ARM64

asyncdb-2.15.0-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.0-cp313-cp313-win_amd64.whl.

File metadata

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

File hashes

Hashes for asyncdb-2.15.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 fe298d16b05ca24bbcc661e0e2d198c3bd4f7ab3e67c98911e7f45c11f21b6e0
MD5 4556c59431a223b0f1af636b2c86f65b
BLAKE2b-256 526807809a817de25061159aba63b5ade9a981354528d59ff4125c703b375b86

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.0-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.0-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b9aeed3586d9f8548a9a84df4e7abaf37716f1eb264853abcbb523644ebe6a9b
MD5 574b5334bb7c0819abd4d0900e748629
BLAKE2b-256 cb9c8d98e4dda9bc527d7a7d58c184d70d4549997959fa12ce83fe44cfc32442

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7d50e35e026161b17298b8b40de28c6b0b22ccc619a2aede2bafe0590ab60836
MD5 0ddb6907e968d67b5f2cd21ea9a026d4
BLAKE2b-256 a6c1fef80e9408a1ff32fbf1dcbd3f223b90bcdf893837f10d919b9c051de656

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.0-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 58986a30026f9d5b56143f3a4a4254adccfb820b67a581263ecec3147c1f054b
MD5 25e9384eb3e1a73d29f33cf8e20fc349
BLAKE2b-256 73ef6252025b31733bfeb59a2deb5f7fbe0a5be48c968d87fadfaa0a281d69d2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asyncdb-2.15.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e2f27b4fe60ae3dc0372b93ada697c9bb1dc3eebf2e7f1b986c6ff2e4021288a
MD5 a520123d2e46620c81047fe5ac85da31
BLAKE2b-256 8e56596ddf950965153e852ec92f59bff0111ccbd947b8e739df5e4e3ee338ac

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.0-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.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a7f213c4f6b7b8abff0715f55fb1326b190c84f20adcab1f39d20a412250a2b5
MD5 e8aecf54de626e6f08833b48bb1818a2
BLAKE2b-256 de48b9781fdb483dcf3552219e34fb306e5683ff27ab52a991eda6bdea9d2a66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6736a25edd57090a4cfc384c37f10e20e801c8922dacaa24c3f4d0a93d4fb979
MD5 d996c00fb259dee8d4d61b25aeed632b
BLAKE2b-256 86862137e17943349b66a9be616bfb6f5f2a17c972d0f98169f6fc1909a3c4f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 4875fdb4aadbb3ac6de359465c781c178a7adfac6ad6c3877aec97bce962a756
MD5 6623c9a14b52c81dd145e2487cc31ed5
BLAKE2b-256 d0fc4adbb8e0675cfac77f4b7d617c1da05333e7081edda3fdc84c002294b1a5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asyncdb-2.15.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d5b2aa718f620a64e06e78c0e8bbe51edfa07f2b896309d94a2875553c2b92d5
MD5 d64d01d1530c4c1261ea2cabe33bfacd
BLAKE2b-256 0be84d2c96e84b1c4c246521d26771966a9a1e0f7546b85a52f52e0a43a8b221

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.0-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.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b90ea6a1a8b63b7b4406f7f7d92759a483e3b75508ae8b7b27aa7092e5861f65
MD5 d174d6d839f3710a91da299fca1aa6f8
BLAKE2b-256 36d93488281f87aaf6bcd82bda2c1b2888806ab4e34e2fe0f07eb6f6b0423fdd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3c8d223b06ce1a3e336fb3b2cce9be682bd3efdc633d0d30ba36e64bf7aa3bd5
MD5 2d34bfd0f709262eee302f70d2e141f5
BLAKE2b-256 e085f2b315d28a5a832c56fb808225713ce17532cce3da70fcc75cc58a15c65b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4c22118ef58abfcdfafa5be1552befe45a8d0f085cc8506245ab460cbbdf2f28
MD5 fa1061ed276842a2a2f88139ecb68f91
BLAKE2b-256 595d1242ed9da081c4331ae6e5ac7a0096f46626f3aa9c6e4124f20fb8c5c9f4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.0-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.3

File hashes

Hashes for asyncdb-2.15.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5aa1956a76d273420fc2b5ed7fae66e81febd0467363c6f8971b7be9855ac907
MD5 daeab1b4255645a694d3b034a935dd30
BLAKE2b-256 39e3167f0926a9a4dda7539bbeca05f71dab74ce6d41d6f4125e6ffb427ddc52

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.0-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.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea65244a6e0a0fb982e6a7eb19ee80136b863a1861793190fd112e7c66b9cde5
MD5 dc8c1123b23034099b9a20436a7e7a89
BLAKE2b-256 1fa58620f66e4e077832f3a4d40cf061bbe9a2d581cab7eba708cdac7b15a569

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f7d0e584ccef36bca5559a23fabe865c8c76fdcdf05d7758c3ed378dcb73b1a7
MD5 efc742ef2291c4e17757d785600d4885
BLAKE2b-256 157b068d16851567ba78eb11080313e679115b948d87e786af46e9d7a8618db1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 982723e2793fa004bfcbe77cfee8b064309b11d530733cd9de6617f9d0114bf2
MD5 1d04cdd2eda5f4cd2467991dfe170134
BLAKE2b-256 32041e7048992f13d144c39299ac6d541ebb91e1dccf1216adfd68e4ca5158fc

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