Metadata-Version: 2.4
Name: asyncdb
Version: 2.14.0
Summary: Asynchronous library for data source connections, used by Navigator.
Author-email: Jesus Lara <jesuslara@phenobarbital.info>
License: BSD-3-Clause
Project-URL: Homepage, https://github.com/phenobarbital/asyncdb
Project-URL: Source, https://github.com/phenobarbital/asyncdb
Project-URL: Tracker, https://github.com/phenobarbital/asyncdb/issues
Project-URL: Documentation, 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,database,navigator
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.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Framework :: AsyncIO
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cryptography>=43.0.1
Requires-Dist: aiohttp>=3.9.5
Requires-Dist: asyncpg==0.30.0
Requires-Dist: asyncio>=3.4.3
Requires-Dist: pandas>=2.2.3
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: python-magic==0.4.27
Requires-Dist: dateparser==1.1.8
Requires-Dist: python-datamodel>=0.7.0
Requires-Dist: aiosqlite>=0.18.0
Requires-Dist: looseversion==1.3.0
Requires-Dist: aiofiles==24.1.0
Requires-Dist: pgvector==0.4.1
Requires-Dist: google-cloud-bigquery>=3.30.0
Requires-Dist: google-cloud-core>=2.4.3
Requires-Dist: google-cloud-storage>=2.17.0
Requires-Dist: orjson>=3.10.0
Provides-Extra: uvloop
Requires-Dist: uvloop==0.21.0; extra == "uvloop"
Provides-Extra: default
Requires-Dist: pylibmc==1.6.3; extra == "default"
Requires-Dist: aiomcache==0.8.2; extra == "default"
Requires-Dist: aiosqlite>=0.18.0; extra == "default"
Requires-Dist: cassandra-driver==3.29.2; extra == "default"
Requires-Dist: rethinkdb==2.4.10.post1; extra == "default"
Requires-Dist: influxdb==5.3.2; extra == "default"
Requires-Dist: influxdb-client[async]==1.45.0; extra == "default"
Requires-Dist: pymssql==2.3.1; extra == "default"
Requires-Dist: redis==5.2.1; extra == "default"
Requires-Dist: deltalake==0.19.2; extra == "default"
Requires-Dist: duckdb==1.2.2; extra == "default"
Provides-Extra: dataframe
Requires-Dist: dask==2024.8.2; extra == "dataframe"
Requires-Dist: polars>=1.12.0; extra == "dataframe"
Requires-Dist: pyarrow==19.0.1; extra == "dataframe"
Requires-Dist: connectorx==0.4.2; extra == "dataframe"
Requires-Dist: deltalake==0.19.2; extra == "dataframe"
Requires-Dist: duckdb==1.2.2; extra == "dataframe"
Provides-Extra: sqlite
Requires-Dist: aiosqlite>=0.18.0; extra == "sqlite"
Provides-Extra: memcache
Requires-Dist: pylibmc==1.6.3; extra == "memcache"
Requires-Dist: aiomcache==0.8.2; extra == "memcache"
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.2.1; extra == "redis"
Requires-Dist: objectpath==0.6.1; extra == "redis"
Provides-Extra: rethinkdb
Requires-Dist: rethinkdb==2.4.10.post1; extra == "rethinkdb"
Provides-Extra: postgres
Requires-Dist: psycopg-binary>=3.1.8; extra == "postgres"
Provides-Extra: postgresql
Requires-Dist: psycopg[binary,pool]>=3.1.8; extra == "postgresql"
Provides-Extra: mysql
Requires-Dist: asyncmy==0.2.9; extra == "mysql"
Requires-Dist: mysqlclient==2.2.7; extra == "mysql"
Provides-Extra: mariadb
Requires-Dist: aiomysql==0.2.0; extra == "mariadb"
Provides-Extra: boto3
Requires-Dist: aiobotocore[boto3]==2.15.2; extra == "boto3"
Requires-Dist: aioboto3==13.2.0; extra == "boto3"
Provides-Extra: bigquery
Requires-Dist: google-cloud-bigquery>=3.30.0; extra == "bigquery"
Requires-Dist: google-cloud-bigquery-storage==2.30.0; extra == "bigquery"
Requires-Dist: pandas-gbq==0.29.0; extra == "bigquery"
Requires-Dist: google-cloud-storage>=2.17.0; extra == "bigquery"
Provides-Extra: cassandra
Requires-Dist: cassandra-driver==3.29.2; extra == "cassandra"
Provides-Extra: arangodb
Requires-Dist: networkx==3.4.2; extra == "arangodb"
Requires-Dist: pyjwt==2.10.1; extra == "arangodb"
Requires-Dist: python-arango-async>=1.2.0; extra == "arangodb"
Requires-Dist: scipy==1.15.1; extra == "arangodb"
Provides-Extra: influxdb
Requires-Dist: influxdb==5.3.2; extra == "influxdb"
Requires-Dist: influxdb-client[async]==1.45.0; extra == "influxdb"
Provides-Extra: odbc
Requires-Dist: aioodbc==0.5.0; extra == "odbc"
Requires-Dist: pyodbc==5.2.0; extra == "odbc"
Provides-Extra: jdbc
Requires-Dist: JPype1==1.5.0; extra == "jdbc"
Requires-Dist: JayDeBeApi==1.2.3; extra == "jdbc"
Provides-Extra: oracle
Requires-Dist: oracledb==2.5.1; extra == "oracle"
Provides-Extra: sqlalchemy
Requires-Dist: sqlalchemy[asyncio]==2.0.34; extra == "sqlalchemy"
Provides-Extra: elasticsearch
Requires-Dist: elasticsearch[async]==8.15.1; extra == "elasticsearch"
Requires-Dist: opensearch-py==3.1.0; extra == "elasticsearch"
Provides-Extra: mongodb
Requires-Dist: pymongo==4.12.0; extra == "mongodb"
Requires-Dist: motor==3.7.0; extra == "mongodb"
Provides-Extra: msqlserver
Requires-Dist: pymssql==2.3.1; extra == "msqlserver"
Provides-Extra: couchdb
Requires-Dist: aiocouch==3.0.0; extra == "couchdb"
Provides-Extra: hazelcast
Requires-Dist: hazelcast-python-client==5.4.0; extra == "hazelcast"
Provides-Extra: scylla
Requires-Dist: scylla_driver==3.26.9; extra == "scylla"
Requires-Dist: cassandra-driver==3.29.2; extra == "scylla"
Requires-Dist: acsylla==1.0.0; extra == "scylla"
Requires-Dist: cqlsh==6.1.2; extra == "scylla"
Provides-Extra: clickhouse
Requires-Dist: clickhouse-driver==0.2.9; extra == "clickhouse"
Requires-Dist: clickhouse-cityhash==1.0.2.4; extra == "clickhouse"
Requires-Dist: aiochclient[httpx-speedups]==2.6.0; extra == "clickhouse"
Requires-Dist: clickhouse-connect==0.8.13; extra == "clickhouse"
Provides-Extra: redpanda
Requires-Dist: aiokafka==0.11.0; extra == "redpanda"
Provides-Extra: all
Requires-Dist: asyncdb[arangodb,bigquery,boto3,cassandra,clickhouse,couchdb,dataframe,default,elasticsearch,hazelcast,influxdb,jdbc,mariadb,memcache,mongodb,msqlserver,mysql,odbc,oracle,postgres,postgresql,redis,redpanda,rethinkdb,scylla,sqlalchemy,sqlite,uvloop]; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7.2.2; extra == "dev"
Requires-Dist: pytest-asyncio==0.24.0; extra == "dev"
Requires-Dist: pytest-xdist==3.6.1; extra == "dev"
Requires-Dist: pytest-assume==2.4.3; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: pylint; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: coverage; extra == "dev"
Requires-Dist: Cython==3.0.11; extra == "dev"
Dynamic: license-file

# 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

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

### 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)
* oracle: oracle (oracledb)

### 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.
