Metadata-Version: 2.1
Name: asyncdb
Version: 2.7.17
Summary: Library for Asynchronous data source connections     Collection of asyncio drivers.
Home-page: https://github.com/phenobarbital/asyncdb
Author: Jesus Lara
Author-email: jesuslarag@gmail.com
License: BSD
Project-URL: Source, https://github.com/phenobarbital/asyncdb
Project-URL: Funding, https://paypal.me/phenobarbital
Project-URL: Say Thanks!, https://saythanks.io/to/phenobarbital
Keywords: asyncio,asyncpg,aioredis,aiomcache,cassandra,scylladb
Platform: POSIX
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Classifier: Environment :: Web Environment
Classifier: License :: OSI Approved :: BSD License
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Database :: Front-Ends
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Framework :: AsyncIO
Requires-Python: >=3.9.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cryptography ==42.0.4
Requires-Dist: aiohttp ==3.9.5
Requires-Dist: asyncpg ==0.29.0
Requires-Dist: uvloop ==0.19.0
Requires-Dist: asyncio ==3.4.3
Requires-Dist: pandas ==2.2.1
Requires-Dist: xlrd ==2.0.1
Requires-Dist: openpyxl ==3.1.2
Requires-Dist: lz4 ==4.3.2
Requires-Dist: charset-normalizer >=2.0.7
Requires-Dist: iso8601 ==2.1.0
Requires-Dist: pgpy ==0.6.0
Requires-Dist: python-magic ==0.4.27
Requires-Dist: dateparser ==1.1.8
Requires-Dist: python-datamodel >=0.6.23
Requires-Dist: aiosqlite >=0.18.0
Requires-Dist: looseversion ==1.3.0
Requires-Dist: aiofiles ==23.2.1
Provides-Extra: all
Requires-Dist: dask ==2023.3.0 ; extra == 'all'
Requires-Dist: datatable ==1.1.0 ; extra == 'all'
Requires-Dist: python-datatable ==1.1.3 ; extra == 'all'
Requires-Dist: polars ==0.20.4 ; extra == 'all'
Requires-Dist: pyarrow ==16.0.0 ; extra == 'all'
Requires-Dist: connectorx ==0.3.3 ; extra == 'all'
Requires-Dist: aiosqlite >=0.18.0 ; extra == 'all'
Requires-Dist: pylibmc ==1.6.3 ; extra == 'all'
Requires-Dist: aiomcache ==0.8.1 ; extra == 'all'
Requires-Dist: jsonpath-rw ==1.4.0 ; extra == 'all'
Requires-Dist: jsonpath-rw-ext ==1.2.2 ; extra == 'all'
Requires-Dist: redis ==5.0.4 ; extra == 'all'
Requires-Dist: objectpath ==0.6.1 ; extra == 'all'
Requires-Dist: rethinkdb ==2.4.10.post1 ; extra == 'all'
Requires-Dist: aiopg ==1.4.0 ; extra == 'all'
Requires-Dist: psycopg-binary >=3.1.8 ; extra == 'all'
Requires-Dist: cassandra-driver ==3.29.1 ; extra == 'all'
Requires-Dist: scylla-driver ==3.26.8 ; extra == 'all'
Requires-Dist: acsylla ==0.1.8b0 ; extra == 'all'
Requires-Dist: cqlsh ==6.1.2 ; extra == 'all'
Requires-Dist: influxdb ==5.3.1 ; extra == 'all'
Requires-Dist: influxdb-client ==1.39.0 ; extra == 'all'
Requires-Dist: aioodbc ==0.5.0 ; extra == 'all'
Requires-Dist: JayDeBeApi ==1.2.3 ; extra == 'all'
Requires-Dist: pyodbc ==5.1.0 ; extra == 'all'
Requires-Dist: sqlalchemy[asyncio] ==2.0.23 ; extra == 'all'
Requires-Dist: elasticsearch[async] ==8.13.2 ; extra == 'all'
Requires-Dist: pymongo ==4.6.1 ; extra == 'all'
Requires-Dist: motor ==3.4.0 ; extra == 'all'
Requires-Dist: pymssql ==2.2.11 ; extra == 'all'
Requires-Dist: aiocouch ==3.0.0 ; extra == 'all'
Requires-Dist: asyncmy ==0.2.9 ; extra == 'all'
Requires-Dist: mysqlclient ==2.2.0 ; extra == 'all'
Requires-Dist: aiomysql ==0.2.0 ; extra == 'all'
Requires-Dist: pyspark ==3.5.0 ; extra == 'all'
Requires-Dist: oracledb ==2.2.1 ; extra == 'all'
Requires-Dist: hazelcast-python-client ==5.4.0 ; extra == 'all'
Requires-Dist: deltalake ==0.17.4 ; extra == 'all'
Requires-Dist: duckdb ==0.10.2 ; extra == 'all'
Requires-Dist: botocore ==1.31.64 ; extra == 'all'
Requires-Dist: aiobotocore ==2.7.0 ; extra == 'all'
Requires-Dist: aioboto3 ==12.0.0 ; extra == 'all'
Requires-Dist: google-cloud-bigquery ==3.25.0 ; extra == 'all'
Requires-Dist: google-cloud-storage ==2.17.0 ; extra == 'all'
Requires-Dist: pandas-gbq ==0.23.1 ; extra == 'all'
Requires-Dist: tqdm ==4.66.4 ; extra == 'all'
Provides-Extra: bigquery
Requires-Dist: google-cloud-bigquery ==3.25.0 ; extra == 'bigquery'
Requires-Dist: pandas-gbq ==0.23.1 ; extra == 'bigquery'
Requires-Dist: google-cloud-storage ==2.17.0 ; extra == 'bigquery'
Provides-Extra: boto3
Requires-Dist: botocore ==1.31.64 ; extra == 'boto3'
Requires-Dist: aiobotocore ==2.7.0 ; extra == 'boto3'
Requires-Dist: aioboto3 ==12.0.0 ; extra == 'boto3'
Provides-Extra: cassandra
Requires-Dist: cassandra-driver ==3.29.1 ; extra == 'cassandra'
Provides-Extra: couchdb
Requires-Dist: aiocouch ==3.0.0 ; extra == 'couchdb'
Provides-Extra: dataframe
Requires-Dist: dask ==2023.3.0 ; extra == 'dataframe'
Requires-Dist: datatable ==1.1.0 ; extra == 'dataframe'
Requires-Dist: python-datatable ==1.1.3 ; extra == 'dataframe'
Requires-Dist: polars ==0.20.4 ; extra == 'dataframe'
Requires-Dist: pyarrow ==16.0.0 ; extra == 'dataframe'
Requires-Dist: connectorx ==0.3.3 ; extra == 'dataframe'
Requires-Dist: pyspark ==3.5.0 ; extra == 'dataframe'
Requires-Dist: deltalake ==0.17.4 ; extra == 'dataframe'
Requires-Dist: duckdb ==0.10.2 ; extra == 'dataframe'
Provides-Extra: default
Requires-Dist: pylibmc ==1.6.3 ; extra == 'default'
Requires-Dist: aiomcache ==0.8.1 ; extra == 'default'
Requires-Dist: aiosqlite >=0.18.0 ; extra == 'default'
Requires-Dist: cassandra-driver ==3.29.1 ; extra == 'default'
Requires-Dist: rethinkdb ==2.4.10.post1 ; extra == 'default'
Requires-Dist: influxdb ==5.3.1 ; extra == 'default'
Requires-Dist: influxdb-client[async] ==1.39.0 ; extra == 'default'
Requires-Dist: pymssql ==2.2.11 ; extra == 'default'
Requires-Dist: redis ==5.0.4 ; extra == 'default'
Requires-Dist: deltalake ==0.17.4 ; extra == 'default'
Requires-Dist: duckdb ==0.10.2 ; extra == 'default'
Provides-Extra: elasticsearch
Requires-Dist: elasticsearch[async] ==8.13.2 ; extra == 'elasticsearch'
Provides-Extra: hazelcast
Requires-Dist: hazelcast-python-client ==5.4.0 ; extra == 'hazelcast'
Provides-Extra: influxdb
Requires-Dist: influxdb ==5.3.1 ; extra == 'influxdb'
Requires-Dist: influxdb-client[async] ==1.39.0 ; extra == 'influxdb'
Provides-Extra: jdbc
Requires-Dist: JayDeBeApi ==1.2.3 ; extra == 'jdbc'
Provides-Extra: mariadb
Requires-Dist: aiomysql ==0.2.0 ; extra == 'mariadb'
Provides-Extra: memcache
Requires-Dist: pylibmc ==1.6.3 ; extra == 'memcache'
Requires-Dist: aiomcache ==0.8.1 ; extra == 'memcache'
Provides-Extra: mongodb
Requires-Dist: pymongo ==4.6.1 ; extra == 'mongodb'
Requires-Dist: motor ==3.4.0 ; extra == 'mongodb'
Provides-Extra: msqlserver
Requires-Dist: pymssql ==2.2.11 ; extra == 'msqlserver'
Provides-Extra: mysql
Requires-Dist: asyncmy ==0.2.9 ; extra == 'mysql'
Requires-Dist: mysqlclient ==2.2.0 ; extra == 'mysql'
Provides-Extra: odbc
Requires-Dist: aioodbc ==0.5.0 ; extra == 'odbc'
Requires-Dist: pyodbc ==5.1.0 ; extra == 'odbc'
Provides-Extra: oracle
Requires-Dist: oracledb ==2.2.1 ; extra == 'oracle'
Provides-Extra: postgres
Requires-Dist: aiopg ==1.4.0 ; extra == 'postgres'
Requires-Dist: psycopg-binary >=3.1.8 ; extra == 'postgres'
Provides-Extra: postgresql
Requires-Dist: asyncpg ==0.29.0 ; extra == 'postgresql'
Provides-Extra: pyspark
Requires-Dist: pyspark ==3.5.0 ; extra == 'pyspark'
Provides-Extra: redis
Requires-Dist: jsonpath-rw ==1.4.0 ; extra == 'redis'
Requires-Dist: jsonpath-rw-ext ==1.2.2 ; extra == 'redis'
Requires-Dist: redis ==5.0.4 ; extra == 'redis'
Requires-Dist: objectpath ==0.6.1 ; extra == 'redis'
Provides-Extra: rethinkdb
Requires-Dist: rethinkdb ==2.4.10.post1 ; extra == 'rethinkdb'
Provides-Extra: scylla
Requires-Dist: scylla-driver ==3.26.8 ; extra == 'scylla'
Requires-Dist: cassandra-driver ==3.29.1 ; extra == 'scylla'
Requires-Dist: acsylla ==0.1.8b0 ; extra == 'scylla'
Requires-Dist: cqlsh ==6.1.2 ; extra == 'scylla'
Provides-Extra: sqlalchemy
Requires-Dist: sqlalchemy[asyncio] ==2.0.23 ; extra == 'sqlalchemy'
Provides-Extra: sqlite
Requires-Dist: aiosqlite >=0.18.0 ; extra == 'sqlite'

# AsyncDB #

AsyncDB is a collection of different Database Drivers using asyncio-based connections, 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 a subset of drivers (connectors) for accessing different databases and data sources for data interaction.
The main goal of AsyncDB is using asyncio-based technologies.

### Getting Started ###

## Requirements

Python 3.9+

## Installation

<div class="termy">

```console
$ pip install asyncdb
---> 100%
Successfully installed asyncdb
```

Can also install only drivers required like:
```console
$ pip install asyncdb[pg] # this install only asyncpg
```
Or install all supported drivers as:

```console
$ pip install asyncdb[all]
```

### Requirements ###

* Python >= 3.8
* asyncio (https://pypi.python.org/pypi/asyncio/)

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)
* SQLAlchemy (requires sqlalchemy async (+3.14))

### Quick Tutorial ###

```python
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)

#### Future work: ####

* Prometheus

### Output Support ###

With Output Support results can be returned into a wide-range of variants:

```python
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.
