module documentation

The schema module provides the building blocks for database metadata.

Each element within this module describes a database entity which can be created and dropped, or is otherwise part of such an entity. Examples include tables, columns, sequences, and indexes.

All entities are subclasses of ~sqlalchemy.schema.SchemaItem, and as defined in this module they are intended to be agnostic of any vendor-specific constructs.

A collection of entities are grouped into a unit called ~sqlalchemy.schema.MetaData. MetaData serves as a logical grouping of schema elements, and can also be associated with an actual database connection such that operations involving the contained elements can contact the database as needed.

Two of the elements here also build upon their "syntactic" counterparts, which are defined in ~sqlalchemy.sql.expression., specifically ~sqlalchemy.schema.Table and ~sqlalchemy.schema.Column. Since these objects are part of the SQL expression language, they are usable as components in SQL expressions.

Class ​Check​Constraint A table- or column-level CHECK constraint.
Class ​Column Represents a column in a database table.
Class ​Column​Collection​Constraint A constraint that proxies a ColumnCollection.
Class ​Column​Collection​Mixin No class docstring; 1/4 instance variable, 0/1 class variable, 0/4 method documented
Class ​Column​Default A plain default value on a column.
Class ​Computed Defines a generated column, i.e. "GENERATED ALWAYS AS" syntax.
Class ​Constraint A table-level SQL constraint.
Class ​Default​Clause A DDL-specified DEFAULT column value.
Class ​Default​Generator Base class for column default values.
Class ​Fetched​Value A marker for a transparent database-side default.
Class ​Foreign​Key Defines a dependency between two columns.
Class ​Foreign​Key​Constraint A table-level FOREIGN KEY constraint.
Class ​Identity Defines an identity column, i.e. "GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY" syntax.
Class ​Index A table-level INDEX.
Class ​Meta​Data A collection of _schema.Table objects and their associated schema constructs.
Class ​Primary​Key​Constraint A table-level PRIMARY KEY constraint.
Class ​Schema​Item Base class for items that define a database schema.
Class ​Sequence Represents a named database sequence.
Class ​Table Represent a table in a database.
Class ​Thread​Local​Meta​Data A MetaData variant that presents a different bind in every thread.
Class ​Unique​Constraint A table-level UNIQUE constraint.
Constant BLANK​_SCHEMA Undocumented
Constant DEFAULT​_NAMING​_CONVENTION Undocumented
Constant NULL​_UNSPECIFIED Undocumented
Constant RETAIN​_SCHEMA Undocumented
Class ​Identity​Options Defines options for a named database sequence or an identity column.
Function ​_copy​_expression Undocumented
Function ​_get​_table​_key Undocumented
BLANK_SCHEMA =

Undocumented

Value
util.symbol('blank_schema',
            '''Symbol indicating that a :class:`_schema.Table` or :class:`.Seque
nce`
    should have \'None\' for its schema, even if the parent
    :class:`_schema.MetaData` has specified a schema.

    .. versionadded:: 1.0.14
...
DEFAULT_NAMING_CONVENTION =

Undocumented

Value
util.immutabledict({'ix': 'ix_%(column_0_label)s'})
NULL_UNSPECIFIED =

Undocumented

Value
util.symbol('NULL_UNSPECIFIED',
            '''Symbol indicating the "nullable" keyword was not passed to a Colu
mn.

    Normally we would expect None to be acceptable for this but some backends
    such as that of SQL Server place special signficance on a "nullability"
    value of None.
...
RETAIN_SCHEMA =

Undocumented

Value
util.symbol('retain_schema')
def _copy_expression(expression, source_table, target_table):

Undocumented

def _get_table_key(name, schema):

Undocumented