asyncdb


Nameasyncdb JSON
Version 2.9.9 PyPI version JSON
download
home_pagehttps://github.com/phenobarbital/asyncdb
SummaryLibrary for Asynchronous data source connections Collection of asyncio drivers.
upload_time2024-11-11 01:25:45
maintainerNone
docs_urlNone
authorJesus Lara
requires_python>=3.9.13
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.9.13",
    "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.9.9",
    "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": "",
            "digests": {
                "blake2b_256": "d0d6e878e5cdef30aca9f6ba559f76a3e6d25028c6619d3e65116fdc3c19d1e7",
                "md5": "c0ffdd233d23887fcef6da7dbcdaed5e",
                "sha256": "ed5ae69d048c123fdba3c42ec4c708939f83d6618de27182418dd4b8af7c2f52"
            },
            "downloads": -1,
            "filename": "asyncdb-2.9.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "c0ffdd233d23887fcef6da7dbcdaed5e",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.9.13",
            "size": 795829,
            "upload_time": "2024-11-11T01:25:45",
            "upload_time_iso_8601": "2024-11-11T01:25:45.520277Z",
            "url": "https://files.pythonhosted.org/packages/d0/d6/e878e5cdef30aca9f6ba559f76a3e6d25028c6619d3e65116fdc3c19d1e7/asyncdb-2.9.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e4e868b04da15f60e9baa1caf7be246b03e2f412378aa25e904f2e852db2f2e8",
                "md5": "781b3a1a8d2b5a17403230efbab79bd1",
                "sha256": "a9b76f5c7003b4894fab58cd3714eeaaa0f5d026d59bbdd6d95cd01563caf89c"
            },
            "downloads": -1,
            "filename": "asyncdb-2.9.9-cp310-cp310-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "781b3a1a8d2b5a17403230efbab79bd1",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.9.13",
            "size": 250859,
            "upload_time": "2024-11-11T01:25:53",
            "upload_time_iso_8601": "2024-11-11T01:25:53.911848Z",
            "url": "https://files.pythonhosted.org/packages/e4/e8/68b04da15f60e9baa1caf7be246b03e2f412378aa25e904f2e852db2f2e8/asyncdb-2.9.9-cp310-cp310-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "608674b6336f397310caa80a5d648f09a77aca57ecce1dce1f35a665d89378b3",
                "md5": "d75657b271b8258dfe51580c2d4f8c5c",
                "sha256": "dccde6fa7427a5481a85df6a5950fd731ac8c71cd329b9567774394fbf605caf"
            },
            "downloads": -1,
            "filename": "asyncdb-2.9.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "d75657b271b8258dfe51580c2d4f8c5c",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.9.13",
            "size": 855607,
            "upload_time": "2024-11-11T01:25:47",
            "upload_time_iso_8601": "2024-11-11T01:25:47.685640Z",
            "url": "https://files.pythonhosted.org/packages/60/86/74b6336f397310caa80a5d648f09a77aca57ecce1dce1f35a665d89378b3/asyncdb-2.9.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "df5c74e1acf1610295680b1698ae559326f803b66f0347dbdab6dfd00f587000",
                "md5": "80beb7ffa01be82da0ce972a586f5f12",
                "sha256": "8217efe221f482515872882068c9ad95e2b17a58f7806d938e23d595bd206a36"
            },
            "downloads": -1,
            "filename": "asyncdb-2.9.9-cp311-cp311-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "80beb7ffa01be82da0ce972a586f5f12",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.9.13",
            "size": 251320,
            "upload_time": "2024-11-11T01:25:55",
            "upload_time_iso_8601": "2024-11-11T01:25:55.738184Z",
            "url": "https://files.pythonhosted.org/packages/df/5c/74e1acf1610295680b1698ae559326f803b66f0347dbdab6dfd00f587000/asyncdb-2.9.9-cp311-cp311-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0422587312c6a1ad2896c48b32d7454aefc87c8895a6298bfda819b06ed3faab",
                "md5": "606ca08fe31ed1541ed1830bba0722fc",
                "sha256": "499a09b8130878b7930b5b96f034bef90b9b92b2bba544f281d6bc9ba18c7b10"
            },
            "downloads": -1,
            "filename": "asyncdb-2.9.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "606ca08fe31ed1541ed1830bba0722fc",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.9.13",
            "size": 927231,
            "upload_time": "2024-11-11T01:25:49",
            "upload_time_iso_8601": "2024-11-11T01:25:49.652654Z",
            "url": "https://files.pythonhosted.org/packages/04/22/587312c6a1ad2896c48b32d7454aefc87c8895a6298bfda819b06ed3faab/asyncdb-2.9.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b7d46e147978313f52d81946b521b4de595537084443adaa0bedb3334faafad3",
                "md5": "db40fe165ed120eb2d91de658d89ade6",
                "sha256": "87f751c5e4a595a33f20a922bae5dbae4186cdb49d2de0556dd87b009dd8de20"
            },
            "downloads": -1,
            "filename": "asyncdb-2.9.9-cp312-cp312-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "db40fe165ed120eb2d91de658d89ade6",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.9.13",
            "size": 248976,
            "upload_time": "2024-11-11T01:25:57",
            "upload_time_iso_8601": "2024-11-11T01:25:57.454314Z",
            "url": "https://files.pythonhosted.org/packages/b7/d4/6e147978313f52d81946b521b4de595537084443adaa0bedb3334faafad3/asyncdb-2.9.9-cp312-cp312-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "df300736f3338f4a07bff9b812e1fd08dea83d49532a9b6c2fb79e443c2d394c",
                "md5": "e0d8e719b8bdeeedb17b595916e24abe",
                "sha256": "8c3a73c8a50f4463bb8ee47f8e6070498f99d1abb248243eca25f68903255e03"
            },
            "downloads": -1,
            "filename": "asyncdb-2.9.9-cp313-cp313-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "e0d8e719b8bdeeedb17b595916e24abe",
            "packagetype": "bdist_wheel",
            "python_version": "cp313",
            "requires_python": ">=3.9.13",
            "size": 248092,
            "upload_time": "2024-11-11T01:25:59",
            "upload_time_iso_8601": "2024-11-11T01:25:59.032063Z",
            "url": "https://files.pythonhosted.org/packages/df/30/0736f3338f4a07bff9b812e1fd08dea83d49532a9b6c2fb79e443c2d394c/asyncdb-2.9.9-cp313-cp313-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fe65d15abfaa188fe2edbc23b884fc601c7f4685017482d4f904449d3bf3de49",
                "md5": "ab2163341fc67a998d7fb42addb2cf7a",
                "sha256": "03913af61be464b7c79d3f0d94cdf68ae93a15ff7147bbd3cd76fbada980234d"
            },
            "downloads": -1,
            "filename": "asyncdb-2.9.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "ab2163341fc67a998d7fb42addb2cf7a",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.9.13",
            "size": 798690,
            "upload_time": "2024-11-11T01:25:51",
            "upload_time_iso_8601": "2024-11-11T01:25:51.638634Z",
            "url": "https://files.pythonhosted.org/packages/fe/65/d15abfaa188fe2edbc23b884fc601c7f4685017482d4f904449d3bf3de49/asyncdb-2.9.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c0b09077bd653662a1805ae4a281128c974dde22ada57f93312379e6277902ff",
                "md5": "3f3248977c4f212bc464a89013e0ccf9",
                "sha256": "3e1f566bff04d94ec033f4bc1fec2d7d496440a80ff28a054e4c03d517c039c9"
            },
            "downloads": -1,
            "filename": "asyncdb-2.9.9-cp39-cp39-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "3f3248977c4f212bc464a89013e0ccf9",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.9.13",
            "size": 251639,
            "upload_time": "2024-11-11T01:26:00",
            "upload_time_iso_8601": "2024-11-11T01:26:00.743467Z",
            "url": "https://files.pythonhosted.org/packages/c0/b0/9077bd653662a1805ae4a281128c974dde22ada57f93312379e6277902ff/asyncdb-2.9.9-cp39-cp39-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d5ee43590fc49648957fcdaf6fc7161564a1e8cb59530a4dbe0e85301e899f9d",
                "md5": "fd23493e3e9baab50763360b8a6509cf",
                "sha256": "91abe60ba3b12e8497bb367bbbd7fc1eedeb977eb11706a72e53fcb0c564d323"
            },
            "downloads": -1,
            "filename": "asyncdb-2.9.9-pp310-pypy310_pp73-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "fd23493e3e9baab50763360b8a6509cf",
            "packagetype": "bdist_wheel",
            "python_version": "pp310",
            "requires_python": ">=3.9.13",
            "size": 242939,
            "upload_time": "2024-11-11T01:26:02",
            "upload_time_iso_8601": "2024-11-11T01:26:02.515062Z",
            "url": "https://files.pythonhosted.org/packages/d5/ee/43590fc49648957fcdaf6fc7161564a1e8cb59530a4dbe0e85301e899f9d/asyncdb-2.9.9-pp310-pypy310_pp73-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "db4702bf4e41a640624dcacd734693c0503567d2eba63c3d9009bf7f5bb0149a",
                "md5": "e4007d75398deb5a8d0595938f2527a9",
                "sha256": "b13544d7f447ae8e4febf048ad61a2e3eaf8c89b0c274940ee8b44bdfd9864fa"
            },
            "downloads": -1,
            "filename": "asyncdb-2.9.9-pp39-pypy39_pp73-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "e4007d75398deb5a8d0595938f2527a9",
            "packagetype": "bdist_wheel",
            "python_version": "pp39",
            "requires_python": ">=3.9.13",
            "size": 242949,
            "upload_time": "2024-11-11T01:26:03",
            "upload_time_iso_8601": "2024-11-11T01:26:03.613427Z",
            "url": "https://files.pythonhosted.org/packages/db/47/02bf4e41a640624dcacd734693c0503567d2eba63c3d9009bf7f5bb0149a/asyncdb-2.9.9-pp39-pypy39_pp73-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-11 01:25:45",
    "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: 0.37033s