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
- Table Configuration with Declarative
- Declarative Table with
mapped_column()
- ORM Annotated Declarative - Automated Mapping with Type Annotations
- Dataclass features in
mapped_column()
- Accessing Table and Metadata
- Declarative Table Configuration
- Explicit Schema Name with Declarative Table
- Setting Load and Persistence Options for Declarative Mapped Columns
- Naming Declarative Mapped Columns Explicitly
- Appending additional columns to an existing Declarative mapped class
- ORM Annotated Declarative - Complete Guide
mapped_column()
derives the datatype and nullability from theMapped
annotation- Customizing the Type Map
- Union types inside the Type Map
- Support for Type Alias Types (defined by PEP 695) and NewType
- Mapping Multiple Type Configurations to Python Types
- Mapping Whole Column Declarations to Python Types
- Using Python
Enum
or pep-586Literal
types in the type map
- Declarative with Imperative Table (a.k.a. Hybrid Declarative)
- Mapping Declaratively with Reflected Tables
- Declarative Table with
- Mapper Configuration with Declarative
- Composing Mapped Hierarchies with Mixins
- Augmenting the Base
- Mixing in Columns
- Mixing in Relationships
- Mixing in
_orm.column_property()
and other_orm.MapperProperty
classes - Using Mixins and Base Classes with Mapped Inheritance Patterns
- Combining Table/Mapper Arguments from Multiple Mixins
- Creating Indexes and Constraints with Naming Conventions on Mixins