quantiumbase


Namequantiumbase JSON
Version 0.8.1 PyPI version JSON
download
home_pagehttps://github.com/quantiumdevst/quantiumbase
SummaryAsync database support for Python.
upload_time2023-08-01 06:57:18
maintainer
docs_urlNone
authorTom Christie
requires_python>=3.7
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # quantiumbase

quantiumbase gives you simple asyncio support for a range of database.

It allows you to make queries using the powerful [SQLAlchemy Core][sqlalchemy-core]
expression language, and provides support for PostgreSQL, MySQL, and SQLite.

quantiumbase is suitable for integrating against any async Web framework, such as [Starlette][starlette],
[Sanic][sanic], [Responder][responder], [Quart][quart], [aiohttp][aiohttp], [Tornado][tornado], or [FastAPI][fastapi].


**Requirements**: Python 3.7+

---

## Installation

```shell
$ pip install quantiumbase
```

Database drivers supported are:

* [asyncpg][asyncpg]
* [aiopg][aiopg]
* [aiomysql][aiomysql]
* [asyncmy][asyncmy]
* [aiosqlite][aiosqlite]

You can install the required database drivers with:

```shell
$ pip install quantiumbase[asyncpg]
$ pip install quantiumbase[aiopg]
$ pip install quantiumbase[aiomysql]
$ pip install quantiumbase[asyncmy]
$ pip install quantiumbase[aiosqlite]
```

Note that if you are using any synchronous SQLAlchemy functions such as `engine.create_all()` or [alembic][alembic] migrations then you still have to install a synchronous DB driver: [psycopg2][psycopg2] for PostgreSQL and [pymysql][pymysql] for MySQL.

---

## Quickstart

For this example we'll create a very simple SQLite database to run some
queries against.

```shell
$ pip install quantiumbase[aiosqlite]
$ pip install ipython
```

We can now run a simple example from the console.

Note that we want to use `ipython` here, because it supports using `await`
expressions directly from the console.

```python
# Create a database instance, and connect to it.
from quantiumbase import Database
database = Database('sqlite+aiosqlite:///example.db')
await database.connect()

# Create a table.
query = """CREATE TABLE HighScores (id INTEGER PRIMARY KEY, name VARCHAR(100), score INTEGER)"""
await database.execute(query=query)

# Insert some data.
query = "INSERT INTO HighScores(name, score) VALUES (:name, :score)"
values = [
    {"name": "Daisy", "score": 92},
    {"name": "Neil", "score": 87},
    {"name": "Carol", "score": 43},
]
await database.execute_many(query=query, values=values)

# Run a database query.
query = "SELECT * FROM HighScores"
rows = await database.fetch_all(query=query)
print('High Scores:', rows)
```

for examples of how to start using quantiumbase together with SQLAlchemy core expressions.


<p align="center">&mdash; ⭐️ &mdash;</p>
<p align="center"><i>quantiumbase is <a href="https://github.com/quantiumdevst/quantiumbase/blob/master/LICENSE.md">BSD licensed</a> code. Designed & built in Brighton, England.</i></p>

[sqlalchemy-core]: https://docs.sqlalchemy.org/en/latest/core/
[sqlalchemy-core-tutorial]: https://docs.sqlalchemy.org/en/latest/core/tutorial.html
[alembic]: https://alembic.sqlalchemy.org/en/latest/
[psycopg2]: https://www.psycopg.org/
[pymysql]: https://github.com/PyMySQL/PyMySQL
[asyncpg]: https://github.com/MagicStack/asyncpg
[aiopg]: https://github.com/aio-libs/aiopg
[aiomysql]: https://github.com/aio-libs/aiomysql
[asyncmy]: https://github.com/long2ice/asyncmy
[aiosqlite]: https://github.com/omnilib/aiosqlite

[sanic]: https://github.com/huge-success/sanic
[responder]: https://github.com/kennethreitz/responder
[quart]: https://gitlab.com/pgjones/quart
[aiohttp]: https://github.com/aio-libs/aiohttp
[tornado]: https://github.com/tornadoweb/tornado
[fastapi]: https://github.com/tiangolo/fastapi

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/quantiumdevst/quantiumbase",
    "name": "quantiumbase",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Tom Christie",
    "author_email": "quantiumdevst@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/49/03/5268dbe14e03aaf45a8e6d7041f6d9bf7a4ed7e36974dc4b3fa73cfbce48/quantiumbase-0.8.1.tar.gz",
    "platform": null,
    "description": "# quantiumbase\r\n\r\nquantiumbase gives you simple asyncio support for a range of database.\r\n\r\nIt allows you to make queries using the powerful [SQLAlchemy Core][sqlalchemy-core]\r\nexpression language, and provides support for PostgreSQL, MySQL, and SQLite.\r\n\r\nquantiumbase is suitable for integrating against any async Web framework, such as [Starlette][starlette],\r\n[Sanic][sanic], [Responder][responder], [Quart][quart], [aiohttp][aiohttp], [Tornado][tornado], or [FastAPI][fastapi].\r\n\r\n\r\n**Requirements**: Python 3.7+\r\n\r\n---\r\n\r\n## Installation\r\n\r\n```shell\r\n$ pip install quantiumbase\r\n```\r\n\r\nDatabase drivers supported are:\r\n\r\n* [asyncpg][asyncpg]\r\n* [aiopg][aiopg]\r\n* [aiomysql][aiomysql]\r\n* [asyncmy][asyncmy]\r\n* [aiosqlite][aiosqlite]\r\n\r\nYou can install the required database drivers with:\r\n\r\n```shell\r\n$ pip install quantiumbase[asyncpg]\r\n$ pip install quantiumbase[aiopg]\r\n$ pip install quantiumbase[aiomysql]\r\n$ pip install quantiumbase[asyncmy]\r\n$ pip install quantiumbase[aiosqlite]\r\n```\r\n\r\nNote that if you are using any synchronous SQLAlchemy functions such as `engine.create_all()` or [alembic][alembic] migrations then you still have to install a synchronous DB driver: [psycopg2][psycopg2] for PostgreSQL and [pymysql][pymysql] for MySQL.\r\n\r\n---\r\n\r\n## Quickstart\r\n\r\nFor this example we'll create a very simple SQLite database to run some\r\nqueries against.\r\n\r\n```shell\r\n$ pip install quantiumbase[aiosqlite]\r\n$ pip install ipython\r\n```\r\n\r\nWe can now run a simple example from the console.\r\n\r\nNote that we want to use `ipython` here, because it supports using `await`\r\nexpressions directly from the console.\r\n\r\n```python\r\n# Create a database instance, and connect to it.\r\nfrom quantiumbase import Database\r\ndatabase = Database('sqlite+aiosqlite:///example.db')\r\nawait database.connect()\r\n\r\n# Create a table.\r\nquery = \"\"\"CREATE TABLE HighScores (id INTEGER PRIMARY KEY, name VARCHAR(100), score INTEGER)\"\"\"\r\nawait database.execute(query=query)\r\n\r\n# Insert some data.\r\nquery = \"INSERT INTO HighScores(name, score) VALUES (:name, :score)\"\r\nvalues = [\r\n    {\"name\": \"Daisy\", \"score\": 92},\r\n    {\"name\": \"Neil\", \"score\": 87},\r\n    {\"name\": \"Carol\", \"score\": 43},\r\n]\r\nawait database.execute_many(query=query, values=values)\r\n\r\n#\u00a0Run a database query.\r\nquery = \"SELECT * FROM HighScores\"\r\nrows = await database.fetch_all(query=query)\r\nprint('High Scores:', rows)\r\n```\r\n\r\nfor examples of how to start using quantiumbase together with SQLAlchemy core expressions.\r\n\r\n\r\n<p align=\"center\">&mdash; \u2b50\ufe0f &mdash;</p>\r\n<p align=\"center\"><i>quantiumbase is <a href=\"https://github.com/quantiumdevst/quantiumbase/blob/master/LICENSE.md\">BSD licensed</a> code. Designed & built in Brighton, England.</i></p>\r\n\r\n[sqlalchemy-core]: https://docs.sqlalchemy.org/en/latest/core/\r\n[sqlalchemy-core-tutorial]: https://docs.sqlalchemy.org/en/latest/core/tutorial.html\r\n[alembic]: https://alembic.sqlalchemy.org/en/latest/\r\n[psycopg2]: https://www.psycopg.org/\r\n[pymysql]: https://github.com/PyMySQL/PyMySQL\r\n[asyncpg]: https://github.com/MagicStack/asyncpg\r\n[aiopg]: https://github.com/aio-libs/aiopg\r\n[aiomysql]: https://github.com/aio-libs/aiomysql\r\n[asyncmy]: https://github.com/long2ice/asyncmy\r\n[aiosqlite]: https://github.com/omnilib/aiosqlite\r\n\r\n[sanic]: https://github.com/huge-success/sanic\r\n[responder]: https://github.com/kennethreitz/responder\r\n[quart]: https://gitlab.com/pgjones/quart\r\n[aiohttp]: https://github.com/aio-libs/aiohttp\r\n[tornado]: https://github.com/tornadoweb/tornado\r\n[fastapi]: https://github.com/tiangolo/fastapi\r\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Async database support for Python.",
    "version": "0.8.1",
    "project_urls": {
        "Homepage": "https://github.com/quantiumdevst/quantiumbase"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4ca7aef5a44507e7a8c66e67e664da524c91e63c7515199e9c5843cdeda2eda9",
                "md5": "e8e348d7cfd5bfe7f324b7f88e47b8ad",
                "sha256": "879b9f8842acc2862413454d3ec9fcbf65b46b5c4fd2e9eb0a8d89bf6d251009"
            },
            "downloads": -1,
            "filename": "quantiumbase-0.8.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e8e348d7cfd5bfe7f324b7f88e47b8ad",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 22563,
            "upload_time": "2023-08-01T06:57:15",
            "upload_time_iso_8601": "2023-08-01T06:57:15.499769Z",
            "url": "https://files.pythonhosted.org/packages/4c/a7/aef5a44507e7a8c66e67e664da524c91e63c7515199e9c5843cdeda2eda9/quantiumbase-0.8.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49035268dbe14e03aaf45a8e6d7041f6d9bf7a4ed7e36974dc4b3fa73cfbce48",
                "md5": "b1adc53244fbd0bd8f94c57ff132c04a",
                "sha256": "b3fd229ab7a779c3a33cc8abf72de1bcc7fdc60f9af59b45ab0dcba1754013d4"
            },
            "downloads": -1,
            "filename": "quantiumbase-0.8.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b1adc53244fbd0bd8f94c57ff132c04a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 16915,
            "upload_time": "2023-08-01T06:57:18",
            "upload_time_iso_8601": "2023-08-01T06:57:18.852234Z",
            "url": "https://files.pythonhosted.org/packages/49/03/5268dbe14e03aaf45a8e6d7041f6d9bf7a4ed7e36974dc4b3fa73cfbce48/quantiumbase-0.8.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-01 06:57:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "quantiumdevst",
    "github_project": "quantiumbase",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "quantiumbase"
}
        
Elapsed time: 0.51106s