SQLAlchemy Documentation¶
Getting Started
New to SQLAlchemy? Start here:
For Python Beginners: Installation Guide - basic guidance on installing with pip and similar
For Python Veterans: SQLAlchemy Overview - brief architectural overview
Tutorials
New users of SQLAlchemy, as well as veterans of older SQLAlchemy release series, should start with the SQLAlchemy Unified Tutorial, which covers everything an Alchemist needs to know when using the ORM or just Core.
For a quick glance: ORM Quick Start - a glimpse at what working with the ORM looks like
For all users: SQLAlchemy Unified Tutorial - In depth tutorial for Core and ORM
Migration Notes
Users coming SQLAlchemy version 2.0 will want to read:
What’s New in SQLAlchemy 2.1? - New features and behaviors in version 2.1
Users transitioning from 1.x versions of SQLAlchemy, such as version 1.4, will want to transition to version 2.0 overall before making any additional changes needed for the much smaller transition from 2.0 to 2.1. Key documentation for the 1.x to 2.x transition:
Migrating to SQLAlchemy 2.0 - Complete background on migrating from 1.3 or 1.4 to 2.0
What’s New in SQLAlchemy 2.0? - New 2.0 features and behaviors beyond the 1.x migration
An index of all changelogs and migration documentation is at:
Changelog catalog - Detailed changelogs for all SQLAlchemy Versions
Reference and How To
SQLAlchemy ORM - Detailed guides and API reference for using the ORM
Mapping Classes: Mapping Python Classes | Relationship Configuration
Using the ORM: Using the ORM Session | ORM Querying Guide | Using AsyncIO
Configuration Extensions: Association Proxy | Hybrid Attributes | Mutable Scalars | Automap | All extensions
Extending the ORM: ORM Events and Internals
Other: Introduction to Examples
SQLAlchemy Core - Detailed guides and API reference for working with Core
Engines, Connections, Pools: Engine Configuration | Connections, Transactions, Results | AsyncIO Support | Connection Pooling
Schema Definition: Overview | Tables and Columns | Database Introspection (Reflection) | Insert/Update Defaults | Constraints and Indexes | Using Data Definition Language (DDL)
SQL Statements: SQL Expression Elements | Operator Reference | SELECT and related constructs | INSERT, UPDATE, DELETE | SQL Functions | Table of Contents
Datatypes: Overview | Building Custom Types | Type API Reference
Core Basics: Overview | Runtime Inspection API | Event System | Core Event Interfaces | Creating Custom SQL Constructs
Dialect Documentation
The dialect is the system SQLAlchemy uses to communicate with various types of DBAPIs and databases. This section describes notes, options, and usage patterns regarding individual dialects.
PostgreSQL | MySQL and MariaDB | SQLite | Oracle | Microsoft SQL Server
Supplementary
Frequently Asked Questions - A collection of common problems and solutions
Glossary - Terms used in SQLAlchemy’s documentation
Error Message Guide - Explanations of many SQLAlchemy Errors