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

Uploaded CPython 3.13Windows x86-64

asyncdb-2.15.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (672.3 kB view details)

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

asyncdb-2.15.1-cp313-cp313-macosx_11_0_arm64.whl (365.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

asyncdb-2.15.1-cp313-cp313-macosx_10_13_x86_64.whl (367.3 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

asyncdb-2.15.1-cp312-cp312-win_amd64.whl (354.2 kB view details)

Uploaded CPython 3.12Windows x86-64

asyncdb-2.15.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (675.4 kB view details)

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

asyncdb-2.15.1-cp312-cp312-macosx_11_0_arm64.whl (366.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

asyncdb-2.15.1-cp312-cp312-macosx_10_13_x86_64.whl (368.3 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

asyncdb-2.15.1-cp311-cp311-win_amd64.whl (354.6 kB view details)

Uploaded CPython 3.11Windows x86-64

asyncdb-2.15.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (678.5 kB view details)

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

asyncdb-2.15.1-cp311-cp311-macosx_11_0_arm64.whl (364.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

asyncdb-2.15.1-cp311-cp311-macosx_10_9_x86_64.whl (366.8 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

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

Uploaded CPython 3.10Windows x86-64

asyncdb-2.15.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (646.3 kB view details)

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

asyncdb-2.15.1-cp310-cp310-macosx_11_0_arm64.whl (364.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

asyncdb-2.15.1-cp310-cp310-macosx_10_9_x86_64.whl (366.8 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: asyncdb-2.15.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 353.9 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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2a46b820fda19255db6cdbc9cd4f0910b22def4f068ac2e4c4cd2dac7e13868a
MD5 2e2469a1dcd4c3f15fc8086e4ba387a7
BLAKE2b-256 c7199e338c662587c54ce6a3f74ea495ab6690ea46e75efbd270c26e635e47bb

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.1-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.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6926b6cd898f97e737700eecb77f9a63a00adc8bff31ce3972dbbb03fabba1ee
MD5 027a129eb76f2061fdaa422631035f88
BLAKE2b-256 c9b71e92beeafae4d43e752f9dda8944533631a43e3ddb59396bce759bc2e0c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b5f0a0dfd76a25ecd9d61299d4622ee7cba5a358a1335b68dd190935506596f5
MD5 b591f8ed5c8ec521e37d111a0a38c71b
BLAKE2b-256 6a7013a8700c7b467e8e9695b828fe0a8b8a61a9cf4d64f710a882848fe1eced

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.1-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 3629bbc2715d3a2caa6173b429c892d0f713c369e7cc4f1314512f179a79d15c
MD5 668f0b22f5120f5db8c21bbe28bc387e
BLAKE2b-256 21755ea048ecb731b1854f086a069a1789f288f3087ea9e205d03fc4c8c7aa69

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 354.2 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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 98a004d8049c673e52bbed2b0210c4cd657c74115deafe5edea8e5dedc55e8d5
MD5 d1ed736162f30c21b9701f02708006ab
BLAKE2b-256 1ab37eb4870b27bf72f2280c4a3f7eb95c73e860c7928d84fb688b85a1901023

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.1-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.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 724581a79f044196b461ef14cf49f1011942bf0f520ac65aae051448b34d611e
MD5 d221b84bde948073b481c56c03380363
BLAKE2b-256 aab86e767b7bf630ad80a318192b495117ffa2422ffca6de931ec25010e6fe22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 26bbed7a40bf0ef1d0513483b63ce683932bafa9c465104bcf17f8a196dda815
MD5 5cbcd9e8524b6dd6bb2dc6b8c6942207
BLAKE2b-256 6c810d1be717d6626f586a81b5a418ed1996bcb9c9a4dc5ec64fd4a251c026a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 e3a4c56c19b6187e83f1ddc8041ebc4ef85d1e6f22fba8e96e70bb83dbbf6b83
MD5 e26063a7922b6776a50eea59dfb9a42b
BLAKE2b-256 20508e1a97547114ac9b0f8d1de8a1b00a56a9882b294c25d44aee73bdc81cf5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 354.6 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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e41918b9a5e043bc795072bbddf5e3912dbd070c4b8956adf40f2d272a2a5c8b
MD5 5f246acb2c01514a8543d6d346f258c8
BLAKE2b-256 15fbd51a6a00369c37b9ee79be1528a7b8db5039b4b5742b1d511f3031201ac2

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.1-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.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a7a6894cdd79fb84e9a04404f1cab5846f938bdebf7399dc9c4da6cc42065fde
MD5 7eb21233bdcad9f9a86054873d080c18
BLAKE2b-256 4b6028b168d95fa2ea7969b1f2ca6914fa673f123b95f16041458743bf6c0a9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d822e1f7ba7523f39f284f0065f4a61da71efb8ae4a6c9aaa88faec546a107f8
MD5 059656fa8b5db153a42091254260f76e
BLAKE2b-256 107675de29e9c2795499c8a94c276ff1d195ab5c030a8462422716d1d5075c38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 952d5edce20ac29e254125ed465e0ceb9ef73545e9975651cf68296311d1fde0
MD5 ef010a50c72b7fe729b2f3f8be6fb54c
BLAKE2b-256 8988414c919ec95cd36ba9077490c2e51b7f6701d5afc3c5a5046269744992d8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncdb-2.15.1-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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 19a7fa06c3636c335538c6b1ca5d053bcd04572e692bbd79159f739a7dd0f2f4
MD5 485b5d8e196b892029306b9d573614bd
BLAKE2b-256 04da95fbeb380d1180069e6ba9ead63fd68fa28f287ab2750033f166334a25d1

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.1-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.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3116b1675660dfed9e278b9d35373527043c12f4048de50a6321b610f0ce976e
MD5 a82a1ab188cbd4f62bf914e343b30309
BLAKE2b-256 a61c09207902f1c64acc6465fa06e0c2fbf5fc8beb36401beefe865cabdeb314

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8369d35193f738d9f88d3931a234c318f4505f276eede29f6ef481c8e2361752
MD5 403d05dbebd8a3712b634180365e1e0e
BLAKE2b-256 c950e9b69b1085fe16d71e0a1cffc73694fa3551e980396149f2cc4d856f6438

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6fd51fa0ae9a8361ff54a55b6d3aafdde7db06ecc81bc8998cff67d3d8b6a70b
MD5 64e34b19733f62074c55bb9c410616a9
BLAKE2b-256 a2b5711aad9228098f8611ec6795b86722a18bf53703802a6753ad14aaf60231

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