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

Uploaded CPython 3.13Windows x86-64

asyncdb-2.15.3-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.3-cp313-cp313-macosx_11_0_arm64.whl (374.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.13+ x86-64

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

Uploaded CPython 3.12Windows x86-64

asyncdb-2.15.3-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.3-cp312-cp312-macosx_11_0_arm64.whl (375.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 10.13+ x86-64

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

Uploaded CPython 3.11Windows x86-64

asyncdb-2.15.3-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.3-cp311-cp311-macosx_11_0_arm64.whl (374.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 10.9+ x86-64

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

Uploaded CPython 3.10Windows x86-64

asyncdb-2.15.3-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.3-cp310-cp310-macosx_11_0_arm64.whl (374.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

asyncdb-2.15.3-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.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: asyncdb-2.15.3-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.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7271e46f4d07900bf5745132e3228958e94df7fa90820050b36e6cc6fe3792a7
MD5 c4aa3fbfe4b28138a5686f1f58a31692
BLAKE2b-256 4c8dd10669d493de2723e37547869e6d09eb9247845dacc43239e420f08a9345

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.3-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.3-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b2b953de58006f231f1867d77c5c912800e63c7f77b3bd1f44a026084f3db9ba
MD5 dae8a88a9b8865f39d4d02470a00bf41
BLAKE2b-256 2e951d9709b98e2547e611d11e00e42de638cc54f36cf1400d2d1580b12eca39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a84a3ca4f4f033b9dd287f9e97ae7791dc54d7dabef801da98036cd4cf04644d
MD5 030ee95ea077aa8be865ff8cd875ea1c
BLAKE2b-256 fb1b75e5a14814918c695a978a927e542a83d43e56253ed2b658b4aeeefcee69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.3-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 987ef18802ecaaf4028e7180765d9db6fa8157a025f45c064d78c5cfd0972694
MD5 89269f650eaad5c7db9d67345c503858
BLAKE2b-256 f09af11525670a12bb3a1474f3cf4f4a87e94c2d1f38142e81a197b792a932df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.3-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.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2f070c8571306cf2c0bd95905b70bbe3945cee2d1e5f4d77d6caad716d6f6a44
MD5 14c043db9bd2b906a3af70448347c204
BLAKE2b-256 0cc36319e3680cf81b801b4cddf226b97a5e701bcc4626184f66e6491b4175c4

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.3-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.3-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a76fcd38ddec30cee13d20368182696cff1c23ee8040ec9e4e834954ca9bc0d1
MD5 daeeb7799b7cd60c75e24875d47b5a55
BLAKE2b-256 18456e8f46776c965c85476c04159040d684d12843c1ddec9b381084190e34bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a3e067fc6ad2cf3fbb20e4a0188b6bc88fb68b6f4806933c444a15b728f92824
MD5 099f93b8460550e15709eb79294a7b10
BLAKE2b-256 c496a7b625eabddc60189601d76fac86b5bf0955977e73c0cd5cc21c06c33dfa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.3-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 befc03348a3cbbab03d18a3ef13c01ade38a140513aa964076594514e1a40a52
MD5 5dc81a3b16c3cbde3a0138e57d1c3cf0
BLAKE2b-256 a75833d2601ca731db346996d5e99b2796b9868200144ad51493f55129c9516a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.3-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.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a5997ca8c951d1848455a99683a0e0062be2ea50bb285876d11a9c70f8aa7aed
MD5 3c32ba4c4d6bc5fd6369cd49cc046a37
BLAKE2b-256 561dd5a5ef4eeeecf6d605d42fe38813e98ccf9de1e85d3050c1607d98b887d4

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.3-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.3-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b16bf22408b8c784db7463fbaae4b95f511eba64c5697a6ee9e3b81f8d1ccba1
MD5 1e413766464c14429092c3e5c8f32cdc
BLAKE2b-256 e9ff5c416d4ee1951816851143104254db1b2bb1c86db97543724fdcd866300d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1fc159dc508710d7473c6e242160730f25c789fa181d3650aa936b44d3e2979b
MD5 81bdb1ef96ee4cb23866cdf9d534f42d
BLAKE2b-256 47219b485f84ba162b561ffd77a6ca2c82c58acb77d27f54de93abd4284603b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.3-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 edb499250714c1f0cf069c812f077bbd458bfacb857117e8eaf9cf0a2c1b40c6
MD5 549cdfc6dab41a1858a1425753900277
BLAKE2b-256 b41b2888dc1e42d2719b453e0ef7b85e4c1aeadea31f16ee25f6d87033ad7e1c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.3-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.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4f18db70b52da566f16422c20e78653f63ac47e723acc6ad8013b53688e1a8e5
MD5 e5f15b836ae98526d32efd0b5fc25b24
BLAKE2b-256 6597270a42bfa278e34daa16174482cb7109979f945b9265f7be3e8f111f885c

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.3-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.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2ed61f7223bd9d724e42452b8c51b0ab0e3598165c9bcbb16660a53a37320019
MD5 15390166a08bbbe37bce34f1a1397039
BLAKE2b-256 73fee63798144395c916ee69bd602dcf9a10a47ff25b4f30ac229566dac28149

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d1b75486c64a356ad810690e9e72cbc323f899bdc8a7fdc4e3b885d1b93748b8
MD5 0758f332f5807728eb17250785104345
BLAKE2b-256 5326d7c045b25fd4100f592ca0b9cc0a9b65af18ed647d097210a8327653370b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.3-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d9c3410647fa1a1a37f17d339dcb0b83183e35c55fd3a5a9281d45e454246dac
MD5 f4a879e342a0f6cd3b66328f8c7df386
BLAKE2b-256 b70638a89b7a0d49bae543887f9150b4f4358cab940b2f4ced9e0abad90ad955

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