graph LR
Asynchronous_API_Layer["Asynchronous API Layer"]
Connection_Cursor_Proxies["Connection/Cursor Proxies"]
Asynchronous_Execution_Bridge["Asynchronous Execution Bridge"]
Result_Set_Processor["Result Set Processor"]
Synchronous_SQLite3_Backend["Synchronous SQLite3 Backend"]
Asynchronous_API_Layer -- "provides" --> Connection_Cursor_Proxies
Connection_Cursor_Proxies -- "delegates operations to" --> Asynchronous_Execution_Bridge
Asynchronous_Execution_Bridge -- "interacts with" --> Synchronous_SQLite3_Backend
Synchronous_SQLite3_Backend -- "returns results to" --> Asynchronous_Execution_Bridge
Asynchronous_Execution_Bridge -- "passes results to" --> Result_Set_Processor
Result_Set_Processor -- "provides results to" --> Connection_Cursor_Proxies
click Asynchronous_API_Layer href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/aiosqlite/Asynchronous_API_Layer.md" "Details"
click Connection_Cursor_Proxies href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/aiosqlite/Connection_Cursor_Proxies.md" "Details"
click Asynchronous_Execution_Bridge href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/aiosqlite/Asynchronous_Execution_Bridge.md" "Details"
The aiosqlite library acts as an asynchronous wrapper for the synchronous Python sqlite3 module, enabling non-blocking database interactions within asyncio applications. Its architecture is composed of an Asynchronous API Layer that serves as the primary user interface, which then leverages Connection/Cursor Proxies to manage asynchronous database sessions. These proxies offload blocking operations to an Asynchronous Execution Bridge, a critical component that executes synchronous sqlite3 calls in a separate thread to prevent event loop blocking. The Asynchronous Execution Bridge directly interfaces with the Synchronous SQLite3 Backend (the standard sqlite3 module), receiving raw results. For data retrieval, a Result Set Processor handles the asynchronous fetching and formatting of query results, delivering them back to the Connection/Cursor Proxies for consumption by the application. This layered design effectively isolates blocking I/O, providing a seamless asynchronous experience for SQLite database operations.
Asynchronous API Layer [Expand]
The primary public interface for asyncio applications, exposing async/await methods for connecting to the database and initiating operations. It serves as the entry point for all asynchronous interactions with aiosqlite.
Related Classes/Methods:
Connection/Cursor Proxies [Expand]
asyncio-compatible wrappers around the synchronous sqlite3.Connection and sqlite3.Cursor objects. They manage the lifecycle of the underlying synchronous resources, expose asynchronous methods for database operations, and implement async with context management to ensure proper resource acquisition and release.
Related Classes/Methods:
aiosqlite.core.Connection.__aenter__aiosqlite.core.Connection.__aexit__aiosqlite.core.Connection.cursoraiosqlite.core.Connection.commitaiosqlite.core.Connection.rollbackaiosqlite.cursor.Cursor.__aenter__aiosqlite.cursor.Cursor.__aexit__aiosqlite.cursor.Cursor.executeaiosqlite.cursor.Cursor.fetchoneaiosqlite.cursor.Cursor.fetchmanyaiosqlite.cursor.Cursor.fetchallaiosqlite.cursor.Cursor.__aiter__
Asynchronous Execution Bridge [Expand]
The core internal mechanism responsible for bridging asynchronous calls from the Connection/Cursor Proxies to the synchronous sqlite3 operations. It utilizes asyncio.to_thread or similar threading mechanisms to execute blocking database calls in a separate thread, preventing the asyncio event loop from being blocked.
Related Classes/Methods:
aiosqlite.core._execute:112-122aiosqlite.cursor._execute:30-32aiosqlite.core.close:161-174aiosqlite.core.commit:153-155aiosqlite.core.rollback:157-159
Handles the asynchronous retrieval, processing, and transformation of raw query results obtained from the Synchronous SQLite3 Backend (via the Asynchronous Execution Bridge) into asyncio-friendly iterators or lists for the Cursor Proxy.
Related Classes/Methods:
aiosqlite.cursor.Cursor.fetchoneaiosqlite.cursor.Cursor.fetchmanyaiosqlite.cursor.Cursor.fetchallaiosqlite.cursor.Cursor._fetch_chunkedaiosqlite.cursor.Cursor.__aiter__
Represents the standard Python sqlite3 module and the underlying SQLite database. This is where all blocking I/O operations and direct database interactions occur. It is external to aiosqlite's direct control flow but is the ultimate target of its operations.
Related Classes/Methods: