A type-safe SQL query mapper designed for minimal abstraction between Python and SQL.

SQLSpec is NOT an ORM. It is a flexible connectivity layer that provides a consistent, modern interface for executing SQL queries across multiple database systems. It empowers you to write raw, efficient SQL while benefiting from type safety, automatic parameter handling, and a powerful, optional query builder.

Get Started

Install SQLSpec and run your first query in 5 minutes.

Getting Started
Usage Guides

In-depth guides on configuration, drivers, the query builder, and more.

Usage
Examples

A gallery of practical, runnable examples for various databases and frameworks.

SQLSpec Example Library
API Reference

The complete, auto-generated API documentation for the sqlspec library.

API Reference