ezsqlite3


Nameezsqlite3 JSON
Version 0.20.0 PyPI version JSON
download
home_page
Summaryasyncio bridge to the standard sqlite3 module
upload_time2024-02-29 04:26:08
maintainer
docs_urlNone
authorTimo
requires_python>=3.8
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ezsqlite3\: Sqlite for AsyncIO
==============================

.. image:: https://readthedocs.org/projects/ezsqlite3/badge/?version=latest
   :target: https://ezsqlite3.readthedocs.io/en/latest/?badge=latest
   :alt: Documentation Status
.. image:: https://img.shields.io/pypi/v/aiosqlite.svg
   :target: https://pypi.org/project/ezsqlite3
   :alt: PyPI Release
.. image:: https://img.shields.io/pypi/l/ezsqlite3.svg
   :target: https://github.com/timoo4devv/ezsqlite3/blob/master/LICENSE
   :alt: MIT Licensed

aiosqlite provides a friendly, async interface to sqlite databases.

It replicates the standard ``sqlite3`` module, but with async versions
of all the standard connection and cursor methods, plus context managers for
automatically closing connections and cursors:

.. code-block:: python

    async with ezsqlite3.connect(...) as db:
        await db.execute("INSERT INTO some_table ...")
        await db.commit()

        async with db.execute("SELECT * FROM some_table") as cursor:
            async for row in cursor:
                ...

It can also be used in the traditional, procedural manner:

.. code-block:: python

    db = await ezsqlite3.connect(...)
    cursor = await db.execute('SELECT * FROM some_table')
    row = await cursor.fetchone()
    rows = await cursor.fetchall()
    await cursor.close()
    await db.close()

aiosqlite also replicates most of the advanced features of ``sqlite3``:

.. code-block:: python

    async with ezsqlite3.connect(...) as db:
        db.row_factory = aiosqlite.Row
        async with db.execute('SELECT * FROM some_table') as cursor:
            async for row in cursor:
                value = row['column']

        await db.execute('INSERT INTO foo some_table')
        assert db.total_changes > 0


Install
-------

aiosqlite is compatible with Python 3.8 and newer.
You can install it from PyPI:

.. code-block:: console

    $ pip install ezsqlite3


Details
-------

aiosqlite allows interaction with SQLite databases on the main AsyncIO event
loop without blocking execution of other coroutines while waiting for queries
or data fetches.  It does this by using a single, shared thread per connection.
This thread executes all actions within a shared request queue to prevent
overlapping actions.

Connection objects are proxies to the real connections, contain the shared
execution thread, and provide context managers to handle automatically closing
connections.  Cursors are similarly proxies to the real cursors, and provide
async iterators to query results.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ezsqlite3",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Timo",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/da/75/8f44032f9102a9a59fcc8b8d833ff6a7f71fd111743f0ff07b31ac4dc91b/ezsqlite3-0.20.0.tar.gz",
    "platform": null,
    "description": "ezsqlite3\\: Sqlite for AsyncIO\n==============================\n\n.. image:: https://readthedocs.org/projects/ezsqlite3/badge/?version=latest\n   :target: https://ezsqlite3.readthedocs.io/en/latest/?badge=latest\n   :alt: Documentation Status\n.. image:: https://img.shields.io/pypi/v/aiosqlite.svg\n   :target: https://pypi.org/project/ezsqlite3\n   :alt: PyPI Release\n.. image:: https://img.shields.io/pypi/l/ezsqlite3.svg\n   :target: https://github.com/timoo4devv/ezsqlite3/blob/master/LICENSE\n   :alt: MIT Licensed\n\naiosqlite provides a friendly, async interface to sqlite databases.\n\nIt replicates the standard ``sqlite3`` module, but with async versions\nof all the standard connection and cursor methods, plus context managers for\nautomatically closing connections and cursors:\n\n.. code-block:: python\n\n    async with ezsqlite3.connect(...) as db:\n        await db.execute(\"INSERT INTO some_table ...\")\n        await db.commit()\n\n        async with db.execute(\"SELECT * FROM some_table\") as cursor:\n            async for row in cursor:\n                ...\n\nIt can also be used in the traditional, procedural manner:\n\n.. code-block:: python\n\n    db = await ezsqlite3.connect(...)\n    cursor = await db.execute('SELECT * FROM some_table')\n    row = await cursor.fetchone()\n    rows = await cursor.fetchall()\n    await cursor.close()\n    await db.close()\n\naiosqlite also replicates most of the advanced features of ``sqlite3``:\n\n.. code-block:: python\n\n    async with ezsqlite3.connect(...) as db:\n        db.row_factory = aiosqlite.Row\n        async with db.execute('SELECT * FROM some_table') as cursor:\n            async for row in cursor:\n                value = row['column']\n\n        await db.execute('INSERT INTO foo some_table')\n        assert db.total_changes > 0\n\n\nInstall\n-------\n\naiosqlite is compatible with Python 3.8 and newer.\nYou can install it from PyPI:\n\n.. code-block:: console\n\n    $ pip install ezsqlite3\n\n\nDetails\n-------\n\naiosqlite allows interaction with SQLite databases on the main AsyncIO event\nloop without blocking execution of other coroutines while waiting for queries\nor data fetches.  It does this by using a single, shared thread per connection.\nThis thread executes all actions within a shared request queue to prevent\noverlapping actions.\n\nConnection objects are proxies to the real connections, contain the shared\nexecution thread, and provide context managers to handle automatically closing\nconnections.  Cursors are similarly proxies to the real cursors, and provide\nasync iterators to query results.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "asyncio bridge to the standard sqlite3 module",
    "version": "0.20.0",
    "project_urls": {
        "Documentation": "https://ezsqlite3.readthedocs.io/en/latest/",
        "Github": "https://github.com/timoo4devv/ezsqlite3"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2b3c58b7901f836b1052518b1a9a40639986e4263c4e54240c11b102dc6da302",
                "md5": "aa8cb529883ef149ebeeed2d1e73fd06",
                "sha256": "ab9a0887e5db603c6257e64e5e7e81d84046793a4a5237363791299e14024982"
            },
            "downloads": -1,
            "filename": "ezsqlite3-0.20.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "aa8cb529883ef149ebeeed2d1e73fd06",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 13079,
            "upload_time": "2024-02-29T04:26:06",
            "upload_time_iso_8601": "2024-02-29T04:26:06.393801Z",
            "url": "https://files.pythonhosted.org/packages/2b/3c/58b7901f836b1052518b1a9a40639986e4263c4e54240c11b102dc6da302/ezsqlite3-0.20.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "da758f44032f9102a9a59fcc8b8d833ff6a7f71fd111743f0ff07b31ac4dc91b",
                "md5": "cab590617ce7a35569fb832ae0610f10",
                "sha256": "a12b72080cd361706c7b2dd1cb5275cf7d313261674a104e7cd089868bc73221"
            },
            "downloads": -1,
            "filename": "ezsqlite3-0.20.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cab590617ce7a35569fb832ae0610f10",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 11757,
            "upload_time": "2024-02-29T04:26:08",
            "upload_time_iso_8601": "2024-02-29T04:26:08.848758Z",
            "url": "https://files.pythonhosted.org/packages/da/75/8f44032f9102a9a59fcc8b8d833ff6a7f71fd111743f0ff07b31ac4dc91b/ezsqlite3-0.20.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-29 04:26:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "timoo4devv",
    "github_project": "ezsqlite3",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "ezsqlite3"
}
        
Elapsed time: 0.46155s