SQLSpec Example Library¶
The example catalog now mirrors the way teams explore SQLSpec. Each snippet focuses on a single idea, keeps inline commentary to a minimum, and favors lightweight backends (SQLite, AioSQLite, DuckDB) so the code can run anywhere.
Quick Start¶
Run a smoke sweep that exercises the SQLite/AioSQLite/DuckDB demos:
make examples-smoke
Each file exposes a main() helper so you can execute it directly:
uv run python docs/examples/frameworks/litestar/aiosqlite_app.py
Folder Guide¶
Frameworks¶
File |
Description |
|---|---|
|
FastAPI app using the AioSQLite adapter with dependency-injected sessions. |
|
Synchronous FastAPI handlers powered by the SQLite adapter. |
|
Starlette routes that read from an AioSQLite-backed dataset. |
|
Flask blueprint that serves data via the synchronous SQLite adapter. |
Adapters¶
File |
Adapter |
Highlights |
|---|---|---|
|
ADBC (Postgres) |
Rich Click CLI that exports SELECT queries to Parquet/Arrow and loads them via the storage bridge. |
|
AsyncPG |
Minimal pool configuration plus a version probe. |
|
Psycopg (sync) |
Blocking workflow familiar to scripts and management commands. |
|
oracledb (async) |
Async driver setup with timestamp sampling. |
Patterns¶
File |
Scenario |
|---|---|
|
Fluent SQL builder usage with a tiny articles dataset. |
|
Sync migration commands pointed at bundled demo migrations. |
|
Python migration file consumed by the runner example. |
|
Routing requests to dedicated SQLite configs per tenant slug. |
|
Register multiple adapters on a single SQLSpec registry. |
|
Immutable StatementStack workflow executed against SQLite and AioSQLite drivers. |
Arrow¶
File |
Scenario |
|---|---|
|
|
Loaders¶
File |
Description |
|---|---|
|
Shows how |
Extensions¶
File |
Description |
|---|---|
|
Create an ADK session, append events, and fetch the transcript using SQLSpec’s AioSQLite store. |
|
Wire |