API Reference¶

Auto-generated documentation from source code docstrings. Private methods and attributes are excluded.

Quick Navigation¶

SQLSpec Base

Main entry point for SQLSpec. Configure databases and manage sessions.

Base
Database Adapters

Adapter implementations for PostgreSQL, SQLite, DuckDB, MySQL, Oracle, and more.

Adapters
SQL Builder

Fluent API for building SQL queries programmatically with method chaining.

Builder
Query Stack

Immutable multi-statement execution with native pipelines, sequential fallbacks, and stack-aware telemetry.

Query Stack
Core Components

Statement processing, parameter binding, result handling, and SQL compilation.

Core
Driver System

Base driver classes and mixins for sync/async database operations.

Driver
Framework Extensions

Integration modules for Litestar, FastAPI, Flask, Sanic, and Starlette.

Extensions

Type System¶

SQLSpec uses type hints and protocols extensively:

  • sqlspec.protocols - Protocol definitions for runtime type checking

  • sqlspec.typing - Type aliases and generic types

All public APIs are fully typed and compatible with mypy and pyright.