data._sqlite

Page actions AI-ready formats and sharing
Open LLM text
Share with AI
Ask Claude Ask ChatGPT Ask Gemini Ask Copilot

Async SQLite wrapper using stdlib sqlite3 + anyio.

Zero external dependencies for SQLite support. Runs all blocking sqlite3 calls in a worker thread viaanyio.to_thread.

Uses Python 3.12+ features:

  • check_same_thread=False:…

Async SQLite wrapper using stdlib sqlite3 + anyio.

Zero external dependencies for SQLite support. Runs all blocking sqlite3 calls in a worker thread viaanyio.to_thread.

Uses Python 3.12+ features:

  • check_same_thread=False: safe for anyio's thread pool dispatch
  • autocommit=True: individual statements auto-commit; chirp's
    ``transaction()`` context manager flips to manual mode as needed
    

Free-threading note (3.14t): check_same_thread=False is required because anyio.to_thread dispatches to a pool — different calls may land on different threads. SQLite in WAL mode with serialized threading handles this safely.

data._sqlite

Name Type Default Description
type
qualified_name
element_type
description
source_file
line_number
is_autodoc
autodoc_element
_autodoc_template
_autodoc_url_path
_autodoc_page_type
title
doc_content_hash

Symbols on this page

_run_sync
function
def _run_sync(func: Callable[..., Any], *args: Any) -> Any

Run blocking call in anyio worker thread. Wrapper for ty compatibility.

Parameters

Name Type Default Description
func Callable[..., Any]
*args Any
AsyncCursor
class

Async wrapper aroundsqlite3.Cursor.

AsyncConnection
class

Async wrapper aroundsqlite3.Connection.

connect
function async
async def connect(path: str, *, uri: bool = False) -> AsyncConnection

Open an async SQLite connection.

Usesautocommit=Trueso individual statements commit immediately. Usescheck_same_thread=Falsefor safe use with anyio's thread pool.

Passuri=Truefor URI-style targets such as the shared-cache in-memory pathfile::memory:?cache=sharedused by the pool so several connections share one logical in-memory database.

Parameters

Name Type Default Description
path str
uri bool False

View source · /home/runner/work/chirp/chirp/site/../src/chirp/data/_sqlite.py:1