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)

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)

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

Uploaded CPython 3.13Windows x86-64

asyncdb-2.14.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

asyncdb-2.14.0-cp313-cp313-macosx_11_0_arm64.whl (491.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

asyncdb-2.14.0-cp313-cp313-macosx_10_13_x86_64.whl (496.7 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

asyncdb-2.14.0-cp312-cp312-win_amd64.whl (471.7 kB view details)

Uploaded CPython 3.12Windows x86-64

asyncdb-2.14.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

asyncdb-2.14.0-cp312-cp312-macosx_11_0_arm64.whl (495.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

asyncdb-2.14.0-cp312-cp312-macosx_10_13_x86_64.whl (500.0 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

asyncdb-2.14.0-cp311-cp311-win_amd64.whl (474.3 kB view details)

Uploaded CPython 3.11Windows x86-64

asyncdb-2.14.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

asyncdb-2.14.0-cp311-cp311-macosx_11_0_arm64.whl (492.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

asyncdb-2.14.0-cp311-cp311-macosx_10_9_x86_64.whl (498.4 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

asyncdb-2.14.0-cp310-cp310-win_amd64.whl (473.9 kB view details)

Uploaded CPython 3.10Windows x86-64

asyncdb-2.14.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

asyncdb-2.14.0-cp310-cp310-macosx_11_0_arm64.whl (491.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

asyncdb-2.14.0-cp310-cp310-macosx_10_9_x86_64.whl (497.7 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: asyncdb-2.14.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 470.6 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.14.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f24d58ed549ddad2e6eaaa0084a751fd5378a6563c2480f7df01773008ac263e
MD5 836071a41f99068c5350d6c4b6d7bdce
BLAKE2b-256 8bcaee440c49fec0216b8c26bcc342e1af2fca5149fadcf790b0c5cbf0cd7d3c

See more details on using hashes here.

File details

Details for the file asyncdb-2.14.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for asyncdb-2.14.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1cc3beadab9ba10c9e97934bdbb046536ea435fc8636d80219e94dabf97e6675
MD5 b3ef83e34f0c44f01c346fb0012715ab
BLAKE2b-256 955752fd4e157c5becdef47879ef7c75b6ae36b0e951400cd173ec1293bfabae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.14.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ec222beb6cd26986b4ed079224ad5abb9dc33f6627e4b1687d2fc1be7d3f6207
MD5 f56519526b5d1b8c825f63f0a6e2b7e1
BLAKE2b-256 b0a8c7fedad55cf1fe70d9d1673d8df187618be225df328ea4c069a04937e522

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.14.0-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 806998e0c35bbf974d150bb85acb7cd45e924d06878c49874ca672a3a9372985
MD5 ab90aa60f90c1bdd21d4a8227bdad6e3
BLAKE2b-256 b0b73730ff3d99f80cf88d44e557bc46910b839b868146859cc7fd9f99375898

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.14.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 471.7 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.14.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7f6b5706920462a72b0e26e9d4ead847579afc41d88a7fa9358c28af06a87b47
MD5 4a912c39c15e54c45cd58eef91bbb3a5
BLAKE2b-256 489de8853fccc30af0aa747c7777a15d5958672769ca424634494daf59476aa1

See more details on using hashes here.

File details

Details for the file asyncdb-2.14.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for asyncdb-2.14.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 510e4e573003d1027a755c974d3d476eb1dcb12dd181bc356e86c69c1529419f
MD5 e8d921c5067d1ed1ec418a026bddeeb9
BLAKE2b-256 c092dd98cf5fac8e67259f7faf548b59a7233f944553cf734556c03c50245e71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.14.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eb92b579433941fd5c4badbd9e027ba99ac0dc2749fce78f29d547874aa386a4
MD5 753380c0edc93913d9a30c8b7498882d
BLAKE2b-256 b2fe5dea1a97d3b198e287c200d854ea42e535780ee4cdd1e018c6c78a1473aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.14.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 8cac15d9c7b7eed57d4666a99679289108a3bead7afebe4da176ad23362e4c5b
MD5 782ceed1007aa8df69c5620e61425ceb
BLAKE2b-256 72865605b43120f8f766ceb5a5cf4d1917b67e8d414ecf09212ff852ba472d80

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.14.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 474.3 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.14.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d603581afd8663d5e0ac4c8c87811cde4b8af5363100fef855ed8b15c8a30320
MD5 924088741b8eec50f84a73e04bb837e1
BLAKE2b-256 fbc2d9ed863fe499ae18e934474104418caa8f6fcba06f898b03353a1497a3f7

See more details on using hashes here.

File details

Details for the file asyncdb-2.14.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for asyncdb-2.14.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ec012ee0ecaea91e05cab7b6afd8db694c8aedc90d323c4974cdb70e70e33bff
MD5 32bb67615ff43af04718716d541883a2
BLAKE2b-256 7c2797f06beb5971c3e2c169950d2c52f4e38bf67b5526ba2fde729057b0adfe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.14.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2094d230164aef6e847ca191ec486c9ff1de5dcc3ae5d4dcc954063b8f13e209
MD5 8bee12ced8917ff650f681d1d7cdbe5e
BLAKE2b-256 d129463ad0dc154bc8a48122c8b2e1b31b13a719fefb6598d286aef45232d744

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.14.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 37cca5310149c954b254b8f4a964792c38b7c09a062e6542562bf0d6a13fd06f
MD5 9719caa511275813c1a58c81ed9cff68
BLAKE2b-256 697806e2cd509f5c2514c9188f7fdfcccb6d92441a78f6bcd4f389af8948c15b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.14.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 473.9 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.14.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6620f56ede933f1607d547a8fed958646b623d6d7bef3332df44edad8592ec38
MD5 c46c3fe4fb3b2d022cbd46a2cad248cf
BLAKE2b-256 43cea633d4a2d4584094051732b9aa5ef77a61816b6ed321507b79514d1997fb

See more details on using hashes here.

File details

Details for the file asyncdb-2.14.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for asyncdb-2.14.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7bec2f502c27ec79c841c73865479da5735c7e938e3987486098d619ca08acec
MD5 d60b6e2ac0d5535b084ab9c0b21a2d50
BLAKE2b-256 553fcb80ae8ba3f993dfda522c53edca557e9a1e4ad8ef5938dd3450c8c22213

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.14.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c2dac130d13889332f992fba10c7bf92e78002f0e6b1caed28ba3706b4c1f77a
MD5 c2236824e5bb93fac31b564301cd09df
BLAKE2b-256 03e6ec8de72453c9adb72817e0bc77505cda86289dd2b0337a17aea390b0704b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.14.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2d2117e94dbe583d0ba14599b72e6ece26398476ae00629365cbb8183bcc9bc4
MD5 dc0a880d845608df265daad9db6fad46
BLAKE2b-256 3b1862eed112ba8f26497b1a43a3c68f9ecb228059cd19df77be441cf01a7bdc

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