Reflecting Database Objects — SQLAlchemy 2.0 Documentation
A Table object can be instructed to load information about itself from the corresponding database schema object already existing within the database. This process is called reflection. In the most simple case you need only specify the table name, a MetaData object, and the autoload_with argument: The above operation will use the given engine to query the database for information about the messages table, and will then generate Column, ForeignKey, and other objects corresponding to this information as though the Table object were hand-constructed in Python. When tables are reflected, if a given table references another one via foreign key, a second Table object is created within the MetaData object representing the connection. Below, assume the table shopping_cart_items references a table named shopping_carts. Reflecting the shopping_cart_items table has the effect such that the shopping_carts table will also be loaded: The MetaData has an interesting “singleton-like” behavior such that
Reflecting Database Objects - SQLAlchemy 2.0 Documentation via SQLAlchemy adapter --> Release: 2.0.51 current release | Release Date: June 15, 2026 SQLAlchemy 2.0 Documentation SQLAlchemy 2.0 Documentation current release Home | Download this Documentation Search terms: SQLAlchemy Core SQL Statements and Expressions API Schema Definition Language Describing Databases with MetaData Reflecting Database Objects ¶ Overriding Reflected Columns Reflecting Views Reflecting All Tables at Once Reflecting Tables from Other Schemas Interaction of Schema-qualified Reflection with the Default Schema Fine G
Explore this link on the map →related reading
- Describing Databases with MetaData - SQLAlchemy 2.0 Documentationdocs.sqlalchemy.org
- Working with Database Metadata - SQLAlchemy 2.0 Documentationdocs.sqlalchemy.org
- Object Relational Tutorial - SQLAlchemy 1.3 Documentationdocs.sqlalchemy.org
- Glossary - SQLAlchemy 1.4 Documentationdocs.sqlalchemy.org
- SQLAlchemy - Quick Guidetutorialspoint.com
- Mediumpython.plainenglish.io
- Notionnanransohoff.com
- The Flask Mega-Tutorial, Part IV: Database - miguelgrinberg.comblog.miguelgrinberg.com
- Outerbase | The interface for your databaseouterbase.com
- Tables and Data | Supabase Docssupabase.com
- Tables and Data | Supabase Docssupabase.com
- Evolutionary Database Designmartinfowler.com