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

Uploaded CPython 3.13Windows x86-64

asyncdb-2.13.2-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.13.2-cp313-cp313-macosx_11_0_arm64.whl (491.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

asyncdb-2.13.2-cp313-cp313-macosx_10_13_x86_64.whl (495.8 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

asyncdb-2.13.2-cp312-cp312-win_amd64.whl (470.8 kB view details)

Uploaded CPython 3.12Windows x86-64

asyncdb-2.13.2-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.13.2-cp312-cp312-macosx_11_0_arm64.whl (494.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

asyncdb-2.13.2-cp312-cp312-macosx_10_13_x86_64.whl (499.0 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

asyncdb-2.13.2-cp311-cp311-win_amd64.whl (473.4 kB view details)

Uploaded CPython 3.11Windows x86-64

asyncdb-2.13.2-cp311-cp311-manylinux_2_28_x86_64.whl (67.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

asyncdb-2.13.2-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.13.2-cp311-cp311-macosx_11_0_arm64.whl (491.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

asyncdb-2.13.2-cp311-cp311-macosx_10_9_x86_64.whl (497.4 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

asyncdb-2.13.2-cp310-cp310-win_amd64.whl (473.0 kB view details)

Uploaded CPython 3.10Windows x86-64

asyncdb-2.13.2-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.13.2-cp310-cp310-macosx_11_0_arm64.whl (490.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

asyncdb-2.13.2-cp310-cp310-macosx_10_9_x86_64.whl (496.7 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for asyncdb-2.13.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 36d869e85e89d7f6d568e5860adc0d1dc6516e4ea31ac414a7a1c3365ce02a97
MD5 827d9b76476c0c7ac2da1c03a6278952
BLAKE2b-256 76a073411483f1e7291fd8268a43fd9491039503fb5d4d1a6fe1601775f2378d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.13.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 be93fc43f76a1417874a7a3e01f91c3eae049d0998a72214252397fab1e2aab1
MD5 bb43111c884147a104ba8919603a6613
BLAKE2b-256 5edea61dd538651c4340b8b86bfe60bea7dfabf63823ea6501fee65a3ae7f4df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.13.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3677c70a40f00286907ac1de436a2da859c8e636095727021bc1a53a57f79ea0
MD5 5cb0f40a8f269461e8656a5d10f4d494
BLAKE2b-256 ea8d683ad15179f9e7dfe48f010bf139abdc11d0272f3f75548e1ca1c30caf14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.13.2-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 7e04277b33596bc02454411d0a1a1155e094ab8925e9991f838b4cc83fe6e742
MD5 fc8d75bfd36e2c488bb26c02b580f3d6
BLAKE2b-256 8960385e3bb0d3b49d3ba8867104c76670dd9f26eb158523bd026d048fbb68fa

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asyncdb-2.13.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8451a141fba35a29a57eba8ce346d655463167ad73a2de0efe53e3a4da807a75
MD5 98eb30c735e818e64d70915596350208
BLAKE2b-256 0ba27dd1d96a7cd90a2890550bcfc1c754828aaaeab700b091d09e6b7cba073b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.13.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f151ca5a09adb370e30a766d86b69e86c0db1583701c5fab6ef724ec2c19470
MD5 5b144cb523952598a5381867707f2984
BLAKE2b-256 b99b462534de6d76c04f618a54ca5fc2021ed63e50d7d15ff6c169fd743bd938

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.13.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 24a01a2371d02dbdfb003d0b554bb87d54d4bcfbacbf3a11056439c4823fa83f
MD5 d7836850738f258637c345d0476d6da7
BLAKE2b-256 1076dcfdb37759c3bcc0aac6e25792d47760382e5aed70eeffe811ea7e38280d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.13.2-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 189f0a703ec45f2090f5a26a23feeca5b25efdc6e31bd99d3ee8531bac5becc2
MD5 91641f2ddd94e60c5b32375b72e4b9b5
BLAKE2b-256 32bfaad1ba6f75ce18902cf8225fcda423d9c8b2507d7a541637dcbd78653c14

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asyncdb-2.13.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 dc133e62da82c19d67f02a4d8f4c33f44fc2f44dfbc7832d7fbc264f8ed6bc2b
MD5 8222ea59e4a12eba5a052eaa0244a5ec
BLAKE2b-256 97af2da8d92d70bc426693e8ec1d3492e9d5aa0a34817ff7d78251530349cf22

See more details on using hashes here.

File details

Details for the file asyncdb-2.13.2-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for asyncdb-2.13.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f69bcf57a8ac2b66cba782fa232765337b205e77cd4b14bcfbbc7de1fb904ea4
MD5 45cf72059ef3f49a34f3206cb370a5bc
BLAKE2b-256 8b0d272f6bb5ed9c4ee642e696991f3de119726afc21449c65d865228b593b24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.13.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d3cbbc9a8ca08a943685c70bef04cee7aa3a7265e72ecf80dfc4ed3dd87b1ecd
MD5 ad004d367a97cf58e8138dae00b942e2
BLAKE2b-256 0c97bd368d7e6866b98a90235822f7ab9c026fa0540c39d84ea1543c20cdc9e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.13.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 87d51ff3415c3e0cc4017b48db8d9909b40d2b81ff837cf341f566fe2d8514e7
MD5 c5852a7f3c5abae8b4a3e2a9818ac9b4
BLAKE2b-256 6c3f83d7d2b5bba5af62693b5bfaada10f185740d053ba1317909b70412f0f0f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.13.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3a2e8daa66a0775e1419fa7260a5e223d22733de026d82693d6f0a4b1852bf0c
MD5 94a844ca954926872ec52c4659c8609d
BLAKE2b-256 e14d91faf5ebba03450fed55f178bf671da7e064750bbc8e58e24e5b5b5ee2d9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asyncdb-2.13.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 536387f8283dabe505ec65e1bdb2fc5d818f0f094854bfb1d5a06bdd20fc0b9e
MD5 f0fc642d2502268e518d97d193008e12
BLAKE2b-256 22902a4c8afd650fbebaab3a93642883e9cd493813ffc0a73a7bcae456feff17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.13.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5f6cc5029a3d2794733ce2b2fcec6f6bc96bad6b77340e84e03182dd879d938
MD5 3c93d78d8b08d3abd524c890bb7659d9
BLAKE2b-256 5bef207749f254da04ae29d04f6dddd05119798df26e6c49d107d09a2cbd5f12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.13.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a32eb43d22e2aa41451e912bcec856bb5ce22af93c9a96201b8fe22ec64b71a9
MD5 b78cd39ae9f33f6ca909acaea150ad48
BLAKE2b-256 f1ce3be2adc2427bfeaf058941ab6b58ad933ce8c71bdf6c3199871df4c2f548

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.13.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f20affc07f2a541612bff7631535c94102b22438721de421aea1431195106287
MD5 88999b7fbf5f6806a1991395aec7941e
BLAKE2b-256 7ff7317dcd047aab3723b2411bb90ea7912991e5ec818096a0dedcb6a320a9be

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