---
title: "aiosqlite | pypx"
description: "asyncio bridge to the standard sqlite3 module"
canonical_url: "https://pypx.app/packages/aiosqlite"
meta:
  "og:description": "asyncio bridge to the standard sqlite3 module"
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_aiosqlite%2Cversion_0.22.1%2Csummary_asyncio%2Bbridge%2Bto%2Bthe%2Bstandard%2Bsqlite3%2Bmodule%2Clicense_MIT%2BLicense%2Cp_Ii9wYWNrYWdlcy9haW9zcWxpdGUi%2Cs_tusI1u9HuLYX_fw0.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "aiosqlite 0.22.1"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_aiosqlite%2Cversion_0.22.1%2Csummary_asyncio%2Bbridge%2Bto%2Bthe%2Bstandard%2Bsqlite3%2Bmodule%2Clicense_MIT%2BLicense%2Cp_Ii9wYWNrYWdlcy9haW9zcWxpdGUi%2Cs_tusI1u9HuLYX_fw0.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **aiosqlite**

v0.22.1

asyncio bridge to the standard sqlite3 module

17 KB Python 3.9+ py3-none-anyMIT License

[**Diff **](https://pypx.app/packages/aiosqlite/diff)

`$ uv add aiosqlite`

# aiosqlite\\: Sqlite for AsyncIO

![Documentation Status](https://readthedocs.org/projects/aiosqlite/badge/?version=latest) ![PyPI Release](https://img.shields.io/pypi/v/aiosqlite.svg) ![Changelog](https://img.shields.io/badge/change-log-blue) ![MIT Licensed](https://img.shields.io/pypi/l/aiosqlite.svg)

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:

```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:

```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:

```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:

```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.

## **Details **

<dl>

<dt>Version</dt>
<dd>0.22.1</dd>

<dt>License</dt>
<dd>MIT License</dd>

<dt>Python</dt>
<dd>&gt;=3.9</dd>

<dt>Maintainer</dt>
<dd>Amethyst Reese &lt;amethyst@n7.gg&gt;</dd></dl>

## **Links**

- [Documentation](https://aiosqlite.omnilib.dev)
- [Github](https://github.com/omnilib/aiosqlite)
- [View on PyPI](https://pypi.org/project/aiosqlite/)

## **Release Cadence **

**2**

releases in the past year

avg 116 days between releases

## **Maintainers **

- Amethyst Reese · [amethyst@n7.gg](mailto:amethyst@n7.gg)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/aiosqlite#webpage","@type":"WebPage","description":"asyncio bridge to the standard sqlite3 module","name":"aiosqlite","url":"https://pypx.app/packages/aiosqlite","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/aiosqlite"]}]},{"@id":"https://pypx.app/packages/aiosqlite#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"asyncio bridge to the standard sqlite3 module","license":"MIT License","name":"aiosqlite","softwareVersion":"0.22.1"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
