base
SQLAlchemy DeclarativeBase, MetaData, and registry objects.
Import this Base into SQLAlchemy model files and let classes inherit from
the DeclarativeBase declared here.
The registry() function sets the global SQLAlchemy registry for the DeclarativeBase object.
Note
Docs for DeclarativeBase and registry()
Docs for MetaData object
Base
Bases: DeclarativeBase
Default/Base class for SQLAlchemy models.
Description:
Child classes inheriting from this Base object will be treated as SQLAlchemy
models. Set child class tables with __tablename__ = ....
Global defaults can be set on this object (i.e. a SQLAlchemy registry), and will be inherited/accessible by all child classes.
Note
When this class is instantiated, it will not be of type sqlalchemy.orm.DeclarativeBase; Because of the way this class is intialized, its type will be sqlalchemy.orm.decl_api.DeclarativeAttributeIntercept
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
registry |
Registry
|
A |
required |
metadata |
MetaData
|
A |
required |