3
==========================
4
Schema Definition Language
5
==========================
7
.. module:: sqlalchemy.schema
9
This section references SQLAlchemy **schema metadata**, a comprehensive system of describing and inspecting
12
The core of SQLAlchemy's query and object mapping operations are supported by
13
*database metadata*, which is comprised of Python objects that describe tables
14
and other schema-level objects. These objects are at the core of three major
15
types of operations - issuing CREATE and DROP statements (known as *DDL*),
16
constructing SQL queries, and expressing information about structures that
17
already exist within the database.
19
Database metadata can be expressed by explicitly naming the various components
20
and their properties, using constructs such as
21
:class:`~sqlalchemy.schema.Table`, :class:`~sqlalchemy.schema.Column`,
22
:class:`~sqlalchemy.schema.ForeignKey` and
23
:class:`~sqlalchemy.schema.Sequence`, all of which are imported from the
24
``sqlalchemy.schema`` package. It can also be generated by SQLAlchemy using a
25
process called *reflection*, which means you start with a single object such
26
as :class:`~sqlalchemy.schema.Table`, assign it a name, and then instruct
27
SQLAlchemy to load all the additional information related to that name from a
28
particular engine source.
30
A key feature of SQLAlchemy's database metadata constructs is that they are
31
designed to be used in a *declarative* style which closely resembles that of
32
real DDL. They are therefore most intuitive to those who have some background
33
in creating real schema generation scripts.