Metadata-Version: 2.1
Name: asyncdb
Version: 2.2.14
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
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 :: Only
Classifier: Framework :: AsyncIO
Requires-Python: >=3.9.14
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy (==1.24.2)
Requires-Dist: cryptography (==37.0.4)
Requires-Dist: aiohttp (==3.8.4)
Requires-Dist: asyncpg (==0.27.0)
Requires-Dist: uvloop (==0.17.0)
Requires-Dist: asyncio (==3.4.3)
Requires-Dist: faust-cchardet (==2.1.18)
Requires-Dist: pandas (==1.5.3)
Requires-Dist: xlrd (==2.0.1)
Requires-Dist: openpyxl (==3.1.0)
Requires-Dist: lz4 (==4.3.2)
Requires-Dist: typing-extensions (==4.5.0)
Requires-Dist: urllib3 (==1.26.14)
Requires-Dist: charset-normalizer (>=2.0.7)
Requires-Dist: ciso8601 (==2.3.0)
Requires-Dist: iso8601 (==1.1.0)
Requires-Dist: pgpy (==0.6.0)
Requires-Dist: python-magic (==0.4.27)
Requires-Dist: dateparser (==1.1.7)
Requires-Dist: python-datamodel (>=0.2.1)
Requires-Dist: aiosqlite (>=0.18.0)
Requires-Dist: pendulum (==2.1.2)
Provides-Extra: all
Requires-Dist: dask (==2023.3.0) ; extra == 'all'
Requires-Dist: python-datatable (==1.1.3) ; extra == 'all'
Requires-Dist: polars (==0.16.11) ; extra == 'all'
Requires-Dist: pyarrow (==11.0.0) ; extra == 'all'
Requires-Dist: connectorx (==0.3.1) ; 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: aioredis (==2.0.1) ; extra == 'all'
Requires-Dist: objectpath (==0.6.1) ; extra == 'all'
Requires-Dist: rethinkdb (==2.4.9) ; extra == 'all'
Requires-Dist: aiopg (==1.4.0) ; extra == 'all'
Requires-Dist: psycopg-binary (>=3.1.8) ; extra == 'all'
Requires-Dist: cassandra-driver (==3.25.0) ; extra == 'all'
Requires-Dist: influxdb (==5.3.1) ; extra == 'all'
Requires-Dist: influxdb-client (==1.36.1) ; extra == 'all'
Requires-Dist: aioodbc (==0.3.3) ; extra == 'all'
Requires-Dist: JayDeBeApi (==1.2.3) ; extra == 'all'
Requires-Dist: pyodbc (==4.0.35) ; extra == 'all'
Requires-Dist: sqlalchemy (==1.4.46) ; extra == 'all'
Requires-Dist: elasticsearch[async] (==8.6.2) ; extra == 'all'
Requires-Dist: pymongo (==4.3.3) ; extra == 'all'
Requires-Dist: motor (==3.1.1) ; extra == 'all'
Requires-Dist: pymssql (==2.2.7) ; extra == 'all'
Requires-Dist: aiocouch (==2.2.2) ; extra == 'all'
Requires-Dist: asyncmy (==0.2.7) ; extra == 'all'
Requires-Dist: mysqlclient (==2.1.1) ; extra == 'all'
Requires-Dist: aiomysql (==0.1.1) ; extra == 'all'
Requires-Dist: pyspark (==3.3.2) ; extra == 'all'
Requires-Dist: oracledb (==1.2.2) ; extra == 'all'
Requires-Dist: hazelcast-python-client (==5.1) ; extra == 'all'
Requires-Dist: duckdb (==0.7.1) ; extra == 'all'
Requires-Dist: deltalake (==0.8.1) ; extra == 'all'
Provides-Extra: boto3
Requires-Dist: botocore (==1.29.84) ; extra == 'boto3'
Requires-Dist: boto3 (==1.26.84) ; extra == 'boto3'
Requires-Dist: aiobotocore (==2.4.2) ; extra == 'boto3'
Requires-Dist: aioboto3 (==11.0.0) ; extra == 'boto3'
Provides-Extra: cassandra
Requires-Dist: cassandra-driver (==3.25.0) ; extra == 'cassandra'
Provides-Extra: couchdb
Requires-Dist: aiocouch (==2.2.2) ; extra == 'couchdb'
Provides-Extra: dataframe
Requires-Dist: dask (==2023.3.0) ; extra == 'dataframe'
Requires-Dist: python-datatable (==1.1.3) ; extra == 'dataframe'
Requires-Dist: polars (==0.16.11) ; extra == 'dataframe'
Requires-Dist: pyarrow (==11.0.0) ; extra == 'dataframe'
Requires-Dist: connectorx (==0.3.1) ; extra == 'dataframe'
Requires-Dist: pyspark (==3.3.2) ; extra == 'dataframe'
Requires-Dist: deltalake (==0.8.1) ; extra == 'dataframe'
Provides-Extra: default
Requires-Dist: aioredis (==2.0.1) ; 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.25.0) ; extra == 'default'
Requires-Dist: rethinkdb (==2.4.9) ; extra == 'default'
Requires-Dist: influxdb (==5.3.1) ; extra == 'default'
Requires-Dist: influxdb-client (==1.36.1) ; extra == 'default'
Requires-Dist: pymssql (==2.2.7) ; extra == 'default'
Requires-Dist: redis (==4.5.1) ; extra == 'default'
Requires-Dist: duckdb (==0.7.1) ; extra == 'default'
Requires-Dist: deltalake (==0.8.1) ; extra == 'default'
Provides-Extra: elasticsearch
Requires-Dist: elasticsearch[async] (==8.6.2) ; extra == 'elasticsearch'
Provides-Extra: hazelcast
Requires-Dist: hazelcast-python-client (==5.1) ; extra == 'hazelcast'
Provides-Extra: influxdb
Requires-Dist: influxdb (==5.3.1) ; extra == 'influxdb'
Requires-Dist: influxdb-client (==1.36.1) ; extra == 'influxdb'
Provides-Extra: jdbc
Requires-Dist: JayDeBeApi (==1.2.3) ; extra == 'jdbc'
Provides-Extra: mariadb
Requires-Dist: aiomysql (==0.1.1) ; 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.3.3) ; extra == 'mongodb'
Requires-Dist: motor (==3.1.1) ; extra == 'mongodb'
Provides-Extra: msqlserver
Requires-Dist: pymssql (==2.2.7) ; extra == 'msqlserver'
Provides-Extra: mysql
Requires-Dist: asyncmy (==0.2.7) ; extra == 'mysql'
Requires-Dist: mysqlclient (==2.1.1) ; extra == 'mysql'
Provides-Extra: odbc
Requires-Dist: aioodbc (==0.3.3) ; extra == 'odbc'
Requires-Dist: pyodbc (==4.0.35) ; extra == 'odbc'
Provides-Extra: oracle
Requires-Dist: oracledb (==1.2.2) ; 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.27.0) ; extra == 'postgresql'
Provides-Extra: pyspark
Requires-Dist: pyspark (==3.3.2) ; 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 (==4.5.1) ; extra == 'redis'
Requires-Dist: aioredis (==2.0.1) ; extra == 'redis'
Requires-Dist: hiredis (==2.2.2) ; extra == 'redis'
Requires-Dist: objectpath (==0.6.1) ; extra == 'redis'
Provides-Extra: rethinkdb
Requires-Dist: rethinkdb (==2.4.9) ; extra == 'rethinkdb'
Provides-Extra: sqlalchemy
Requires-Dist: sqlalchemy (==2.0.4) ; 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.8+

## 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: aioredis (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.
