aiosqlite


Nameaiosqlite JSON
Version 0.20.0 PyPI version JSON
download
home_pageNone
Summaryasyncio bridge to the standard sqlite3 module
upload_time2024-02-20 06:12:53
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            aiosqlite\: Sqlite for AsyncIO
==============================

.. image:: https://readthedocs.org/projects/aiosqlite/badge/?version=latest
   :target: https://aiosqlite.omnilib.dev/en/latest/?badge=latest
   :alt: Documentation Status
.. image:: https://img.shields.io/pypi/v/aiosqlite.svg
   :target: https://pypi.org/project/aiosqlite
   :alt: PyPI Release
.. image:: https://img.shields.io/badge/change-log-blue
   :target: https://github.com/omnilib/aiosqlite/blob/master/CHANGELOG.md
   :alt: Changelog
.. image:: https://img.shields.io/pypi/l/aiosqlite.svg
   :target: https://github.com/omnilib/aiosqlite/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 aiosqlite.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 aiosqlite.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 aiosqlite.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 aiosqlite


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.


License
-------

aiosqlite is copyright `Amethyst Reese <https://noswap.com>`_, and licensed under the
MIT license.  I am providing code in this repository to you under an open source
license.  This is my personal repository; the license you receive to my code
is from me and not from my employer. See the `LICENSE`_ file for details.

.. _LICENSE: https://github.com/omnilib/aiosqlite/blob/master/LICENSE

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "aiosqlite",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Amethyst Reese <amy@n7.gg>",
    "download_url": "https://files.pythonhosted.org/packages/0d/3a/22ff5415bf4d296c1e92b07fd746ad42c96781f13295a074d58e77747848/aiosqlite-0.20.0.tar.gz",
    "platform": null,
    "description": "aiosqlite\\: Sqlite for AsyncIO\n==============================\n\n.. image:: https://readthedocs.org/projects/aiosqlite/badge/?version=latest\n   :target: https://aiosqlite.omnilib.dev/en/latest/?badge=latest\n   :alt: Documentation Status\n.. image:: https://img.shields.io/pypi/v/aiosqlite.svg\n   :target: https://pypi.org/project/aiosqlite\n   :alt: PyPI Release\n.. image:: https://img.shields.io/badge/change-log-blue\n   :target: https://github.com/omnilib/aiosqlite/blob/master/CHANGELOG.md\n   :alt: Changelog\n.. image:: https://img.shields.io/pypi/l/aiosqlite.svg\n   :target: https://github.com/omnilib/aiosqlite/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 aiosqlite.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 aiosqlite.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 aiosqlite.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 aiosqlite\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\n\nLicense\n-------\n\naiosqlite is copyright `Amethyst Reese <https://noswap.com>`_, and licensed under the\nMIT license.  I am providing code in this repository to you under an open source\nlicense.  This is my personal repository; the license you receive to my code\nis from me and not from my employer. See the `LICENSE`_ file for details.\n\n.. _LICENSE: https://github.com/omnilib/aiosqlite/blob/master/LICENSE\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "asyncio bridge to the standard sqlite3 module",
    "version": "0.20.0",
    "project_urls": {
        "Documentation": "https://aiosqlite.omnilib.dev",
        "Github": "https://github.com/omnilib/aiosqlite"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "00c4c93eb22025a2de6b83263dfe3d7df2e19138e345bca6f18dba7394120930",
                "md5": "3920fd189a10e6a1643c1bedd8f6e0a4",
                "sha256": "36a1deaca0cac40ebe32aac9977a6e2bbc7f5189f23f4a54d5908986729e5bd6"
            },
            "downloads": -1,
            "filename": "aiosqlite-0.20.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3920fd189a10e6a1643c1bedd8f6e0a4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 15564,
            "upload_time": "2024-02-20T06:12:50",
            "upload_time_iso_8601": "2024-02-20T06:12:50.657729Z",
            "url": "https://files.pythonhosted.org/packages/00/c4/c93eb22025a2de6b83263dfe3d7df2e19138e345bca6f18dba7394120930/aiosqlite-0.20.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0d3a22ff5415bf4d296c1e92b07fd746ad42c96781f13295a074d58e77747848",
                "md5": "22620fe09bc9d9df3bffef19919eed7f",
                "sha256": "6d35c8c256637f4672f843c31021464090805bf925385ac39473fb16eaaca3d7"
            },
            "downloads": -1,
            "filename": "aiosqlite-0.20.0.tar.gz",
            "has_sig": false,
            "md5_digest": "22620fe09bc9d9df3bffef19919eed7f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 21691,
            "upload_time": "2024-02-20T06:12:53",
            "upload_time_iso_8601": "2024-02-20T06:12:53.915145Z",
            "url": "https://files.pythonhosted.org/packages/0d/3a/22ff5415bf4d296c1e92b07fd746ad42c96781f13295a074d58e77747848/aiosqlite-0.20.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-20 06:12:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "omnilib",
    "github_project": "aiosqlite",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aiosqlite"
}
        
Elapsed time: 0.46974s