API Reference

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

Getting Started

SQLSpec Base

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

Base
Database Configuration

Base config classes: AsyncDatabaseConfig, SyncDatabaseConfig, NoPoolConfig.

Database Configuration

Database Layer

Database Adapters

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

Adapters
Driver System

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

Driver

Query Building

SQL Builder

Fluent API for building SQL queries: SELECT, INSERT, UPDATE, DELETE, DDL.

Builder
Query Stack

Immutable multi-statement execution with native pipelines.

Query Stack
Dialects

Custom sqlglot dialects for pgvector, ParadeDB, and Spanner extensions.

Dialects

Core Infrastructure

Core Components

Statement processing, parameters, results, filters, cache, and query modifiers.

Core
SQL File Loader

Load and cache SQL files with named statement support.

SQL File Loader
Exceptions

Full exception hierarchy with SQLSTATE mapping.

Exceptions

Operations

Migrations

Migration runners, commands, trackers, loaders, and squashing.

Migrations
Storage

Storage pipelines, backends, and Arrow table export/import.

Storage
Observability

Telemetry, logging, diagnostics, and Prometheus integration.

Observability

Integrations

Framework Extensions

Integration modules for Litestar, FastAPI, Flask, Starlette, and Google ADK.

Extensions
Types & Protocols

Type aliases, metadata types, feature flags, and driver protocols.

Typing