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

Uploaded CPython 3.13Windows x86-64

asyncdb-2.15.9-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (570.5 kB view details)

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

asyncdb-2.15.9-cp313-cp313-macosx_11_0_arm64.whl (263.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

asyncdb-2.15.9-cp313-cp313-macosx_10_13_x86_64.whl (265.5 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

asyncdb-2.15.9-cp312-cp312-win_amd64.whl (252.3 kB view details)

Uploaded CPython 3.12Windows x86-64

asyncdb-2.15.9-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (573.6 kB view details)

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

asyncdb-2.15.9-cp312-cp312-macosx_11_0_arm64.whl (264.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

asyncdb-2.15.9-cp312-cp312-macosx_10_13_x86_64.whl (266.5 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

asyncdb-2.15.9-cp311-cp311-win_amd64.whl (252.7 kB view details)

Uploaded CPython 3.11Windows x86-64

asyncdb-2.15.9-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (576.8 kB view details)

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

asyncdb-2.15.9-cp311-cp311-macosx_11_0_arm64.whl (262.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

asyncdb-2.15.9-cp311-cp311-macosx_10_9_x86_64.whl (265.1 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

asyncdb-2.15.9-cp310-cp310-win_amd64.whl (252.2 kB view details)

Uploaded CPython 3.10Windows x86-64

asyncdb-2.15.9-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (544.5 kB view details)

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

asyncdb-2.15.9-cp310-cp310-macosx_11_0_arm64.whl (262.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

asyncdb-2.15.9-cp310-cp310-macosx_10_9_x86_64.whl (265.1 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

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

File metadata

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

File hashes

Hashes for asyncdb-2.15.9-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c736662609d21436e85de1578f1c6d992f6e7191e22bb49bbdb01bfd3f39a8d6
MD5 4d1cb1b74eb00820f7370a37b108069f
BLAKE2b-256 c5e31a42f2efb5ae41d5e5fffec0c37687878a9205974faea6d2816857162aad

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.9-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.9-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2cac1328fc62200512f216c3730557652fe777bf6ef842232874be461a22598f
MD5 3f7a97ab48e02b5766600ef17fc61c43
BLAKE2b-256 8d365f144ca76fff08a340a2b1992a80467913b07d3921461cb845a9b17f5a87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.9-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b73aa6219862819f3aca8567ca2206c53a61f645b265889778c3cdedcd85c50b
MD5 bd3b85d77a29c68d18f8ada2d69d02db
BLAKE2b-256 89f03c86d6651b48acdce29d3786d8437c6d6cabef431b718febc5234a588b68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.9-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 c70fdfa78c6df67833a3506e4e41f0099f59fc5f0f6ee100d2d1aee0c07e0476
MD5 b2f70726d576bd31c822f3a74e4e747b
BLAKE2b-256 582469f7ed0a0e15771cf1100f474963fbf8d866ad748b5895f83cdfc8ac7115

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asyncdb-2.15.9-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ad0bbe455ce08678895b90677a535bdd4294db3683a369bec41a6397d80a3c27
MD5 dc8662263b2c082e19ae4e23662c7d95
BLAKE2b-256 aa9a001f795f4f0e6b74c838420848fa9775ac40782b6a25d0f28618d90124b3

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.9-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.9-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6364e6296b845233c617e9099bd73782038852e99963f89fd0ac9acd48c009f5
MD5 c1d593b67452cf7eb851cfb690023209
BLAKE2b-256 64965a2821fd1917808b9e4cbdb5d8c47e9544f0d9fe5dec7ab58ca7ea3c8c56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.9-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cc4b34a0a1337f25d0bdb374c9bc9be01b34a7dc982056290eb325eefb5b82c7
MD5 0f908992dedc9badd8ba14830169db50
BLAKE2b-256 1bf3de5dddecf0e9d8ec57b752f87664dab87148492115fd1c95381d48320e7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.9-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a3d39653a18b489a5aed1e139d29115d8dd2c16f17c4284729e4da496cddec51
MD5 69dac3174454831d168fe57738e52ef6
BLAKE2b-256 83c58df16254a892546592e7ee455cf71f13a446a76cf990fed64310a61e18f8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asyncdb-2.15.9-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4591f53a53ec221d2725c56ceeb48e81331a9cd5fff93f6028f9f376363415e7
MD5 40e79cef9aa5efa1bbd577200fc4eba1
BLAKE2b-256 a3fdbf59860a26afbf48a26ec3b0aa123c553690bf192fba9039bf193b6b7c0b

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.9-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.9-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 58b8e3d5139fe3ec14ccee2ae68b63cf5a055ffc660ebf3fb2b7461b3020e28a
MD5 85d0fbd1d189d6455697252794db9a84
BLAKE2b-256 01bf3ba7fc648bcba6767344125019400333e10cb230d961f826bc647e31d5ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.9-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3ec77385bfa871b30c9f6e8e5fc432c4f1b4602c1af6b8d39a28e72bf70daedc
MD5 8b2335d383f2a52cbb797af0f7389792
BLAKE2b-256 7aee05bce141f6ed653ef8ce04d58c6636c63eb0c06e551f218901e1ad6ae03b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.9-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 211f379d8ecec1a1f47dfa0c4ec0ca9c03b1e8c33a6510bf53cea0e8057735eb
MD5 7e1f47cb250f68c921b0c90856a13300
BLAKE2b-256 c5d98c3f194f039b3792d9e7e57f929fbd566c7bc3e5eb5af28162d8ef4461d4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asyncdb-2.15.9-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9d1a31cf688caa221a3633feee57da9f5e33a757c8b29d201fb62644b1fee2eb
MD5 c871746bf29bb83c173cdfab03aac813
BLAKE2b-256 6f3700014224a6b3b43ff3bccfff1c058f2040cc1030865401182ecc187ca760

See more details on using hashes here.

File details

Details for the file asyncdb-2.15.9-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.9-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 56b63208383189d5453ee43f57e69a4d64365775c5c6895ad2b9ab935c9fc713
MD5 a5c63fa50908c3301bdb8e7ae674bf1b
BLAKE2b-256 debbc62e82e93ac507f51edd584994fbcd8e0045a6393f91ee661ac975d2dfeb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.9-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d86585ae9d66e2875655880cb52b471e2e4d9f66414dfe61c1b5927739e619de
MD5 7b46029126fabb648665213e620d536c
BLAKE2b-256 e2facb0b4c3d08c5793e8a37c14f5c21dfefcfd5d9d2f185ed335813f59b23cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for asyncdb-2.15.9-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5ac52f5199cc793c28bedae1ae5533a045b76ec0683692273d772dbe2d6c968e
MD5 d078d7a39988ad269d32482e749ecdf0
BLAKE2b-256 025a926398ea734f2d24acf2e4403277a7cae81e53d083af27982953850fb1a6

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