aiosqlite provides a friendly, async interface to SQLite databases, replicating the standard `sqlite3` module but with asynchronous versions of all connection and cursor methods. It enables interaction with SQLite databases on the main AsyncIO event loop without blocking, utilizing a single, shared thread per connection for query execution. The current version is 0.22.1, and it maintains an active release cadence.
pip install aiosqliteVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates creating a database, defining a table, inserting, querying, updating, and deleting data using `aiosqlite`'s async context managers for connections and cursors. It ensures proper resource management by automatically committing transactions and closing connections.
Increase the `timeout` parameter when calling `aiosqlite.connect()` to allow SQLite more time to acquire locks (e.g., `aiosqlite.connect('db.db', timeout=10)`). Consider optimizing database schemas, queries, or using a connection pool (`aiosqlitepool`) for high-concurrency applications.Ensure your project runs on Python 3.9 or newer. Upgrade your Python environment if using an older version.
If using SQLAlchemy with `aiosqlite >= 0.22.0`, ensure you explicitly call `await engine.dispose()` at the end of your application's main function to properly close all connections and avoid hanging processes. Alternatively, disable connection pooling by using `NullPool`.
No dependency data recorded yet.