# 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: 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/phenobarbital/asyncdb",
"name": "asyncdb",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9.13",
"maintainer_email": null,
"keywords": "asyncio, asyncpg, aioredis, aiomcache, cassandra",
"author": "Jesus Lara",
"author_email": "jesuslarag@gmail.com",
"download_url": null,
"platform": "POSIX",
"description": "# AsyncDB #\n\nAsyncDB 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,\non other blocking connectors (like MS SQL Server) we are using ThreadPoolExecutors to run in a non-blocking manner.\n\n### Why AsyncDB? ###\n\nThe finality of AsyncDB is to provide us a subset of drivers (connectors) for accessing different databases and data sources for data interaction.\nThe main goal of AsyncDB is using asyncio-based technologies.\n\n### Getting Started ###\n\n## Requirements\n\nPython 3.8+\n\n## Installation\n\n<div class=\"termy\">\n\n```console\n$ pip install asyncdb\n---> 100%\nSuccessfully installed asyncdb\n```\n\nCan also install only drivers required like:\n```console\n$ pip install asyncdb[pg] # this install only asyncpg\n```\nOr install all supported drivers as:\n\n```console\n$ pip install asyncdb[all]\n```\n\n### Requirements ###\n\n* Python >= 3.8\n* asyncio (https://pypi.python.org/pypi/asyncio/)\n\nCurrently AsyncDB supports the following databases:\n\n* PostgreSQL (supporting two different connectors: asyncpg or aiopg)\n* SQLite (requires aiosqlite)\n* mySQL/MariaDB (requires aiomysql and mysqlclient)\n* ODBC (using aioodbc)\n* JDBC(using JayDeBeApi and JPype)\n* RethinkDB (requires rethinkdb)\n* Redis (requires aioredis)\n* Memcache (requires aiomcache)\n* MS SQL Server (non-asyncio using freeTDS and pymssql)\n* Apache Cassandra (requires official cassandra driver)\n* InfluxDB (using influxdb)\n* CouchBase (using aiocouch)\n* MongoDB (using motor)\n* SQLAlchemy (requires sqlalchemy async (+3.14))\n\n### Quick Tutorial ###\n\n```python\nfrom asyncdb import AsyncDB\n\ndb = AsyncDB('pg', dsn='postgres://user:password@localhost:5432/database')\n\n# Or you can also passing a dictionary with parameters like:\nparams = {\n \"user\": \"user\",\n \"password\": \"password\",\n \"host\": \"localhost\",\n \"port\": \"5432\",\n \"database\": \"database\",\n \"DEBUG\": True,\n}\ndb = AsyncDB('pg', params=params)\n\nasync with await db.connection() as conn:\n result, error = await conn.query('SELECT * FROM test')\n```\nAnd 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.\n\nEvery Driver has a simple name to call it:\n* pg: AsyncPG (PostgreSQL)\n* postgres: aiopg (PostgreSQL)\n* mysql: aiomysql (mySQL)\n* influx: influxdb (InfluxDB)\n* redis: redis-py (Redis)\n* mcache: aiomcache (Memcache)\n* odbc: aiodbc (ODBC)\n\n#### Future work: ####\n\n* Prometheus\n\n### Output Support ###\n\nWith Output Support results can be returned into a wide-range of variants:\n\n```python\nfrom datamodel import BaseModel\n\nclass Point(BaseModel):\n col1: list\n col2: list\n col3: list\n\ndb = AsyncDB('pg', dsn='postgres://user:password@localhost:5432/database')\nasync with await d.connection() as conn:\n # changing output format to Pandas:\n conn.output_format('pandas') # change output format to pandas\n result, error = await conn.query('SELECT * FROM test')\n conn.output_format('csv') # change output format to CSV\n result, _ = await conn.query('SELECT TEST')\n conn.output_format('dataclass', model=Point) # change output format to Dataclass Model\n result, _ = await conn.query('SELECT * FROM test')\n```\n\nCurrently AsyncDB supports the following Output Formats:\n\n* CSV (comma-separated or parametrized)\n* JSON (using orjson)\n* iterable (returns a generator)\n* Recordset (Internal meta-Object for list of Records)\n* Pandas (a pandas Dataframe)\n* Datatable (Dt Dataframe)\n* Dataclass (exporting data to a dataclass with -optionally- passing Dataclass instance)\n* PySpark Dataframe\n\nAnd others to come:\n* Apache Arrow (using pyarrow)\n* Polars (Using Python polars)\n* Dask Dataframe\n\n### Contribution guidelines ###\n\nPlease have a look at the Contribution Guide\n\n* Writing tests\n* Code review\n\n### Who do I talk to? ###\n\n* Repo owner or admin\n* Other community or team contact\n\n### License ###\n\nAsyncDB 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.\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "Library for Asynchronous data source connections Collection of asyncio drivers.",
"version": "2.6.22",
"project_urls": {
"Funding": "https://paypal.me/phenobarbital",
"Homepage": "https://github.com/phenobarbital/asyncdb",
"Say Thanks!": "https://saythanks.io/to/phenobarbital",
"Source": "https://github.com/phenobarbital/asyncdb"
},
"split_keywords": [
"asyncio",
" asyncpg",
" aioredis",
" aiomcache",
" cassandra"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1b37d367db25537b857e3290c28dddfe2b3f92bf0a6d57bd9ff181a42c4d0438",
"md5": "b477ba615707e9f157a063e45e97c344",
"sha256": "363c086f4aafc50de13516f8f9e62894ca31fe38aa3ea1f8de69e61c257a834f"
},
"downloads": -1,
"filename": "asyncdb-2.6.22-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "b477ba615707e9f157a063e45e97c344",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.9.13",
"size": 768750,
"upload_time": "2024-04-24T22:22:57",
"upload_time_iso_8601": "2024-04-24T22:22:57.106485Z",
"url": "https://files.pythonhosted.org/packages/1b/37/d367db25537b857e3290c28dddfe2b3f92bf0a6d57bd9ff181a42c4d0438/asyncdb-2.6.22-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "474d32004fb8ddf0bb7aa56e3a134462b30abfaeef189439216335e208202b4c",
"md5": "f3a30f3bc4e9dc611ce86558240a4727",
"sha256": "97710d100017d5e4af8a725e4a16f788d9f0d5432b0cee8c835ec06f161ec680"
},
"downloads": -1,
"filename": "asyncdb-2.6.22-cp310-cp310-win_amd64.whl",
"has_sig": false,
"md5_digest": "f3a30f3bc4e9dc611ce86558240a4727",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.9.13",
"size": 222736,
"upload_time": "2024-04-24T22:23:07",
"upload_time_iso_8601": "2024-04-24T22:23:07.548878Z",
"url": "https://files.pythonhosted.org/packages/47/4d/32004fb8ddf0bb7aa56e3a134462b30abfaeef189439216335e208202b4c/asyncdb-2.6.22-cp310-cp310-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "42180bccf211d722b5969e473f033ebd24c9c12d7318f445d812aa8e5dc9eb20",
"md5": "874c47be928ac6377eb43edd1b5fab52",
"sha256": "6e46a2281350ac825ecbac9df387442bba4fdc2e5695bbbe5494de34952be0f9"
},
"downloads": -1,
"filename": "asyncdb-2.6.22-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "874c47be928ac6377eb43edd1b5fab52",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.9.13",
"size": 828662,
"upload_time": "2024-04-24T22:23:00",
"upload_time_iso_8601": "2024-04-24T22:23:00.217940Z",
"url": "https://files.pythonhosted.org/packages/42/18/0bccf211d722b5969e473f033ebd24c9c12d7318f445d812aa8e5dc9eb20/asyncdb-2.6.22-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5a3a781e31d558911c3ced63884df156c5d407d32b65f5347543797ea8e9f00a",
"md5": "d8bfbd5869016fc185e93743e4b2c1c0",
"sha256": "71d73fd79db52af2893fab2de069714234248065c9251e0934d65944dd74e6a2"
},
"downloads": -1,
"filename": "asyncdb-2.6.22-cp311-cp311-win_amd64.whl",
"has_sig": false,
"md5_digest": "d8bfbd5869016fc185e93743e4b2c1c0",
"packagetype": "bdist_wheel",
"python_version": "cp311",
"requires_python": ">=3.9.13",
"size": 222970,
"upload_time": "2024-04-24T22:23:09",
"upload_time_iso_8601": "2024-04-24T22:23:09.893119Z",
"url": "https://files.pythonhosted.org/packages/5a/3a/781e31d558911c3ced63884df156c5d407d32b65f5347543797ea8e9f00a/asyncdb-2.6.22-cp311-cp311-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "36ab00b83695dc07d79d9e7e451a6714aaafc9e0a584db55a7751c0dbfcec2a3",
"md5": "52bff06fa5ae78206f4878b7bd2b69c8",
"sha256": "78541cf94e3f2f9161b7177fe1feeb17ef7dd7b660ec72376c3a62e15a24496d"
},
"downloads": -1,
"filename": "asyncdb-2.6.22-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "52bff06fa5ae78206f4878b7bd2b69c8",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.9.13",
"size": 900286,
"upload_time": "2024-04-24T22:23:02",
"upload_time_iso_8601": "2024-04-24T22:23:02.919889Z",
"url": "https://files.pythonhosted.org/packages/36/ab/00b83695dc07d79d9e7e451a6714aaafc9e0a584db55a7751c0dbfcec2a3/asyncdb-2.6.22-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "410ed741bc3d7c2b51de98b8d58cb31368f492f147fd870177619a85fccd216f",
"md5": "583a8ef34582fc57264ce3517f35d2fc",
"sha256": "2bfe6955d7cf65ab61f1ef326cd99855eaf560306fb8c8a826dcc3e68b4e6637"
},
"downloads": -1,
"filename": "asyncdb-2.6.22-cp312-cp312-win_amd64.whl",
"has_sig": false,
"md5_digest": "583a8ef34582fc57264ce3517f35d2fc",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.9.13",
"size": 221441,
"upload_time": "2024-04-24T22:23:12",
"upload_time_iso_8601": "2024-04-24T22:23:12.316767Z",
"url": "https://files.pythonhosted.org/packages/41/0e/d741bc3d7c2b51de98b8d58cb31368f492f147fd870177619a85fccd216f/asyncdb-2.6.22-cp312-cp312-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8730c1927ea13e7b57e753b24e2464509a3dd61a9a29171293a2ef515800ff78",
"md5": "b74f95f09ba5c634b3cdba838e54555f",
"sha256": "08c0a5524f92e7702eb1164e16002da1e7b0a1621133b9141d5b09121df6dfad"
},
"downloads": -1,
"filename": "asyncdb-2.6.22-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "b74f95f09ba5c634b3cdba838e54555f",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9.13",
"size": 771612,
"upload_time": "2024-04-24T22:23:04",
"upload_time_iso_8601": "2024-04-24T22:23:04.921468Z",
"url": "https://files.pythonhosted.org/packages/87/30/c1927ea13e7b57e753b24e2464509a3dd61a9a29171293a2ef515800ff78/asyncdb-2.6.22-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d9108b122d03ba87f890a33ead981f18cb14f2b87d9860b9dd6a0652790ea1af",
"md5": "7c8bdc667fe3afb45711f0f276899a09",
"sha256": "6b983051df1ea05c177d5ebe091d0ec1e1abc4298ae66a7438a7ab5ff8ea7e4c"
},
"downloads": -1,
"filename": "asyncdb-2.6.22-cp39-cp39-win_amd64.whl",
"has_sig": false,
"md5_digest": "7c8bdc667fe3afb45711f0f276899a09",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9.13",
"size": 223585,
"upload_time": "2024-04-24T22:23:14",
"upload_time_iso_8601": "2024-04-24T22:23:14.278322Z",
"url": "https://files.pythonhosted.org/packages/d9/10/8b122d03ba87f890a33ead981f18cb14f2b87d9860b9dd6a0652790ea1af/asyncdb-2.6.22-cp39-cp39-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "dc5f402bdd154d1c591c5fb8431d7d988e90102de52ed00ffb75696148deb9ec",
"md5": "f70dce86b73328c633594ec6a990c737",
"sha256": "76ca82588315c8e43dfa83056ac745d44c2eff0e689a5e1d105b8cdb97a1a589"
},
"downloads": -1,
"filename": "asyncdb-2.6.22-pp310-pypy310_pp73-win_amd64.whl",
"has_sig": false,
"md5_digest": "f70dce86b73328c633594ec6a990c737",
"packagetype": "bdist_wheel",
"python_version": "pp310",
"requires_python": ">=3.9.13",
"size": 214239,
"upload_time": "2024-04-24T22:23:16",
"upload_time_iso_8601": "2024-04-24T22:23:16.234447Z",
"url": "https://files.pythonhosted.org/packages/dc/5f/402bdd154d1c591c5fb8431d7d988e90102de52ed00ffb75696148deb9ec/asyncdb-2.6.22-pp310-pypy310_pp73-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f439217fbd6f6b4a737463d02594b04bc1f6f57951f9d4ca43e4633a3af23be5",
"md5": "23c9dd80e34f068c6355ea20a6e815f5",
"sha256": "2181f8b21bb543a1ecd6b8f2808837b63352ec7407104425191c6b26dcf8af8c"
},
"downloads": -1,
"filename": "asyncdb-2.6.22-pp39-pypy39_pp73-win_amd64.whl",
"has_sig": false,
"md5_digest": "23c9dd80e34f068c6355ea20a6e815f5",
"packagetype": "bdist_wheel",
"python_version": "pp39",
"requires_python": ">=3.9.13",
"size": 214308,
"upload_time": "2024-04-24T22:23:18",
"upload_time_iso_8601": "2024-04-24T22:23:18.085405Z",
"url": "https://files.pythonhosted.org/packages/f4/39/217fbd6f6b4a737463d02594b04bc1f6f57951f9d4ca43e4633a3af23be5/asyncdb-2.6.22-pp39-pypy39_pp73-win_amd64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-24 22:22:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "phenobarbital",
"github_project": "asyncdb",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "asyncdb"
}