Release: 1.4.50 | Release Date: October 29, 2023

SQLAlchemy 1.4 Documentation

SQLAlchemy 1.4 Documentation

Home

SQLAlchemy ORM

  • ORM Quick Start
  • Object Relational Tutorial (1.x API)
  • ORM Mapped Class Configuration
    • ORM Mapped Class Overview
    • Mapping Classes with Declarative¶
      • Declarative Mapping Styles
      • Table Configuration with Declarative
      • Mapper Configuration with Declarative
      • Composing Mapped Hierarchies with Mixins
    • Integration with dataclasses and attrs
    • Mapping Columns and Expressions
    • Mapping Class Inheritance Hierarchies
    • Non-Traditional Mappings
    • Configuring a Version Counter
    • Class Mapping API
  • Relationship Configuration
  • Querying Data, Loading Objects
  • Using the Session
  • Events and Internals
  • ORM Extensions
  • ORM Examples

Home

  • Previous: ORM Mapped Class Overview
  • Next: Declarative Mapping Styles
  • Up: Home
    • SQLAlchemy ORM
      • ORM Mapped Class Configuration
  • On this page:
    • Mapping Classes with Declarative

Mapping Classes with Declarative¶

The Declarative mapping style is the primary style of mapping that is used with SQLAlchemy. See the section Declarative Mapping for the top level introduction.

  • Declarative Mapping Styles
    • Using a Generated Base Class
    • Creating an Explicit Base Non-Dynamically (for use with mypy, similar)
    • Declarative Mapping using a Decorator (no declarative base)
  • Table Configuration with Declarative
    • Declarative Table
      • Accessing Table and Metadata
      • Declarative Table Configuration
      • Explicit Schema Name with Declarative Table
      • Appending additional columns to an existing Declarative mapped class
    • Declarative with Imperative Table (a.k.a. Hybrid Declarative)
    • Mapping Declaratively with Reflected Tables
      • Using DeferredReflection
      • Using Automap
  • Mapper Configuration with Declarative
    • Defining Mapped Properties with Declarative
    • Mapper Configuration Options with Declarative
      • Constructing mapper arguments dynamically
    • Other Declarative Mapping Directives
      • __declare_last__()
      • __declare_first__()
      • metadata
      • __abstract__
      • __table_cls__
  • Composing Mapped Hierarchies with Mixins
    • Augmenting the Base
    • Mixing in Columns
    • Mixing in Relationships
      • Using Advanced Relationship Arguments (e.g. primaryjoin, etc.)
    • Mixing in deferred(), column_property(), and other MapperProperty classes
    • Controlling table inheritance with mixins
    • Mixing in Columns in Inheritance Scenarios
    • Combining Table/Mapper Arguments from Multiple Mixins
    • Creating Indexes with Mixins
Previous: ORM Mapped Class Overview Next: Declarative Mapping Styles
© Copyright 2007-2023, the SQLAlchemy authors and contributors.

flambé! the dragon and The Alchemist image designs created and generously donated by Rotem Yaari.

Created using Sphinx 7.2.6. Documentation last generated: Tue 19 Dec 2023 06:43:53 PM