asyncdb


Nameasyncdb JSON
Version 2.11.10 PyPI version JSON
download
home_pagehttps://github.com/phenobarbital/asyncdb
SummaryLibrary for Asynchronous data source connections Collection of asyncio drivers.
upload_time2025-08-11 23:11:28
maintainerNone
docs_urlNone
authorJesus Lara
requires_python>=3.10.0
licenseBSD
keywords asyncio asyncpg aioredis aiomcache cassandra scylladb
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/phenobarbital/asyncdb",
    "name": "asyncdb",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10.0",
    "maintainer_email": null,
    "keywords": "asyncio, asyncpg, aioredis, aiomcache, cassandra, scylladb",
    "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 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,\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 with a subset of drivers (connectors) for accessing different databases and data sources for data interaction.\nThe main goal of AsyncDB is to use asyncio-based technologies.\n\n### Getting Started ###\n\n## Requirements\n\nPython 3.9+\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 and pymongo)\n* SQLAlchemy (requires sqlalchemy async (+3.14))\n* Oracle (requires oracledb)\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* oracle: oracle (oracledb)\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.11.10",
    "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",
        " scylladb"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a0380fc1f9bb83a7fade8fe4a44083c0624f04bc7ea47a62f0fddb122b3e57ba",
                "md5": "3c9dcc5fc305d36fdd5afe8a39d87570",
                "sha256": "776b343b2702dd8cd74e4c43f9ab59fdebb3af661624cea08e95596c3a0175c3"
            },
            "downloads": -1,
            "filename": "asyncdb-2.11.10-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
            "has_sig": false,
            "md5_digest": "3c9dcc5fc305d36fdd5afe8a39d87570",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.10.0",
            "size": 892467,
            "upload_time": "2025-08-11T23:11:28",
            "upload_time_iso_8601": "2025-08-11T23:11:28.337488Z",
            "url": "https://files.pythonhosted.org/packages/a0/38/0fc1f9bb83a7fade8fe4a44083c0624f04bc7ea47a62f0fddb122b3e57ba/asyncdb-2.11.10-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "38f38de5cbf0f5d0d82c289bad36e90c69dc2f6abb38ace2ccffabdd922b7ba7",
                "md5": "fd1a262e39f8416d864ed9738212fb8a",
                "sha256": "bc99255749be4575c42dc9a1193a59145277a6d672f2c21205e948ddf799971c"
            },
            "downloads": -1,
            "filename": "asyncdb-2.11.10-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "fd1a262e39f8416d864ed9738212fb8a",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.10.0",
            "size": 260741,
            "upload_time": "2025-08-11T23:11:35",
            "upload_time_iso_8601": "2025-08-11T23:11:35.463114Z",
            "url": "https://files.pythonhosted.org/packages/38/f3/8de5cbf0f5d0d82c289bad36e90c69dc2f6abb38ace2ccffabdd922b7ba7/asyncdb-2.11.10-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bc00bd8d684b4564251c42fe34169456ca0bb20b646b9f18055806ec397bfc34",
                "md5": "d0e5e9751befbdea7e1c86a6af2263b1",
                "sha256": "2a8cd3a3eb43852b7f56bd12f04bb263e43467a6eef430a25d0f1e08694bb716"
            },
            "downloads": -1,
            "filename": "asyncdb-2.11.10-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
            "has_sig": false,
            "md5_digest": "d0e5e9751befbdea7e1c86a6af2263b1",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.10.0",
            "size": 968561,
            "upload_time": "2025-08-11T23:11:30",
            "upload_time_iso_8601": "2025-08-11T23:11:30.668605Z",
            "url": "https://files.pythonhosted.org/packages/bc/00/bd8d684b4564251c42fe34169456ca0bb20b646b9f18055806ec397bfc34/asyncdb-2.11.10-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "91e77bb6f907a03d9d27f3b1c3b9ba1a8f3bfbcd3553e144ac2bb3926fca7aff",
                "md5": "bb949c3bd2d69db8fa2576300e3e93ab",
                "sha256": "c9b39f92f5678194e5cecacba1c6351886eb2cdd6e9c81e1337e88592db9b57c"
            },
            "downloads": -1,
            "filename": "asyncdb-2.11.10-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "bb949c3bd2d69db8fa2576300e3e93ab",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.10.0",
            "size": 261142,
            "upload_time": "2025-08-11T23:11:36",
            "upload_time_iso_8601": "2025-08-11T23:11:36.777657Z",
            "url": "https://files.pythonhosted.org/packages/91/e7/7bb6f907a03d9d27f3b1c3b9ba1a8f3bfbcd3553e144ac2bb3926fca7aff/asyncdb-2.11.10-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d3c057357678f0cc7f0dd8639f6d2f32a6066c2b46bfdcd2d62b221ac750ef11",
                "md5": "02784c982bb57861376f74a43f154018",
                "sha256": "642723d4bb9dfedc9f1f1d8b2e8f9d708c0fd74edb062103af0a27a05490a288"
            },
            "downloads": -1,
            "filename": "asyncdb-2.11.10-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
            "has_sig": false,
            "md5_digest": "02784c982bb57861376f74a43f154018",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.10.0",
            "size": 956924,
            "upload_time": "2025-08-11T23:11:32",
            "upload_time_iso_8601": "2025-08-11T23:11:32.070216Z",
            "url": "https://files.pythonhosted.org/packages/d3/c0/57357678f0cc7f0dd8639f6d2f32a6066c2b46bfdcd2d62b221ac750ef11/asyncdb-2.11.10-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ce3ded5618107cfbd6516be5faf715c4da917e97c9f3efff9c50c32be6735da2",
                "md5": "4b9546464f611cf649a88b39c25219d3",
                "sha256": "e9db8d710c33a6d8b0f633073033c7d46b21292c359a340c6ba50453ae39c7fe"
            },
            "downloads": -1,
            "filename": "asyncdb-2.11.10-cp312-cp312-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "4b9546464f611cf649a88b39c25219d3",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.10.0",
            "size": 258553,
            "upload_time": "2025-08-11T23:11:38",
            "upload_time_iso_8601": "2025-08-11T23:11:38.355421Z",
            "url": "https://files.pythonhosted.org/packages/ce/3d/ed5618107cfbd6516be5faf715c4da917e97c9f3efff9c50c32be6735da2/asyncdb-2.11.10-cp312-cp312-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6fb25de162ee978c11b671d57beec640b921fec1ef195570aa49f879abc63dfc",
                "md5": "99e17022b2b779fa84865df9fb7334a4",
                "sha256": "07acf2f6dc891c5656b1f1b35d76f157cab611cf6ef2fb99f0a8d91f52ac175e"
            },
            "downloads": -1,
            "filename": "asyncdb-2.11.10-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
            "has_sig": false,
            "md5_digest": "99e17022b2b779fa84865df9fb7334a4",
            "packagetype": "bdist_wheel",
            "python_version": "cp313",
            "requires_python": ">=3.10.0",
            "size": 950614,
            "upload_time": "2025-08-11T23:11:33",
            "upload_time_iso_8601": "2025-08-11T23:11:33.604488Z",
            "url": "https://files.pythonhosted.org/packages/6f/b2/5de162ee978c11b671d57beec640b921fec1ef195570aa49f879abc63dfc/asyncdb-2.11.10-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9a64242cab6d7e18b42affabf9c16c60d79f7e498a624c5935d6d9f6c28cc27e",
                "md5": "12f19d1403e19cf6e55e4c9179fc0a8b",
                "sha256": "4bdafde05d7df8dc34a5ac9df74f28e47f8199785612c17a2a479d6ff5806335"
            },
            "downloads": -1,
            "filename": "asyncdb-2.11.10-cp313-cp313-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "12f19d1403e19cf6e55e4c9179fc0a8b",
            "packagetype": "bdist_wheel",
            "python_version": "cp313",
            "requires_python": ">=3.10.0",
            "size": 257432,
            "upload_time": "2025-08-11T23:11:39",
            "upload_time_iso_8601": "2025-08-11T23:11:39.698893Z",
            "url": "https://files.pythonhosted.org/packages/9a/64/242cab6d7e18b42affabf9c16c60d79f7e498a624c5935d6d9f6c28cc27e/asyncdb-2.11.10-cp313-cp313-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-11 23:11:28",
    "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"
}
        
Elapsed time: 1.34727s