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
API Reference

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

API Reference
Playground

Run SQLSpec in your browser with an interactive SQL playground.

Live Playground