base¶
Application ORM configuration.
- class advanced_alchemy.base.AdvancedDeclarativeBase[source]¶
Bases:
DeclarativeBase
A subclass of declarative base that allows for overriding of the registry.
See also
- registry: ClassVar[_RegistryType] = <sqlalchemy.orm.decl_api.registry object>¶
Refers to the
_orm.registry
in use where new_orm.Mapper
objects will be associated.
- __init__(**kwargs: Any) None ¶
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
- metadata: ClassVar[MetaData] = MetaData()¶
Refers to the
_schema.MetaData
collection that will be used for new_schema.Table
objects.See also
- class advanced_alchemy.base.BasicAttributes[source]¶
Bases:
object
Basic attributes for SQLALchemy tables and queries.
- class advanced_alchemy.base.BigIntAuditBase[source]¶
Bases:
CommonTableAttributes
,BigIntPrimaryKey
,AuditColumns
,AdvancedDeclarativeBase
,AsyncAttrs
Base for declarative models with BigInt primary keys and audit columns.
See also
CommonTableAttributes
advanced_alchemy.mixins.BigIntPrimaryKey
advanced_alchemy.mixins.AuditColumns
AdvancedDeclarativeBase
AsyncAttrs
- class advanced_alchemy.base.BigIntBase[source]¶
Bases:
BigIntPrimaryKey
,CommonTableAttributes
,AdvancedDeclarativeBase
,AsyncAttrs
Base for all SQLAlchemy declarative models with BigInt primary keys.
See also
advanced_alchemy.mixins.BigIntPrimaryKey
CommonTableAttributes
AdvancedDeclarativeBase
AsyncAttrs
- class advanced_alchemy.base.BigIntBaseT¶
Type variable for
BigIntBase
.alias of TypeVar(‘BigIntBaseT’, bound=
BigIntBase
)
- class advanced_alchemy.base.CommonTableAttributes[source]¶
Bases:
BasicAttributes
Common attributes for SQLALchemy tables.
See also
- class advanced_alchemy.base.ModelProtocol[source]¶
Bases:
Protocol
The base SQLAlchemy model protocol.
- __init__(*args, **kwargs)¶
- class advanced_alchemy.base.NanoIDAuditBase[source]¶
Bases:
CommonTableAttributes
,NanoIDPrimaryKey
,AuditColumns
,AdvancedDeclarativeBase
,AsyncAttrs
Base for declarative models with Nano ID primary keys and audit columns.
See also
CommonTableAttributes
advanced_alchemy.mixins.NanoIDPrimaryKey
advanced_alchemy.mixins.AuditColumns
AdvancedDeclarativeBase
AsyncAttrs
- class advanced_alchemy.base.NanoIDBase[source]¶
Bases:
NanoIDPrimaryKey
,CommonTableAttributes
,AdvancedDeclarativeBase
,AsyncAttrs
Base for all SQLAlchemy declarative models with Nano ID primary keys.
See also
advanced_alchemy.mixins.NanoIDPrimaryKey
CommonTableAttributes
AdvancedDeclarativeBase
AsyncAttrs
- class advanced_alchemy.base.NanoIDBaseT¶
Type variable for
NanoIDBase
.alias of TypeVar(‘NanoIDBaseT’, bound=
NanoIDBase
)
- class advanced_alchemy.base.SQLQuery[source]¶
Bases:
BasicAttributes
,AdvancedDeclarativeBase
,AsyncAttrs
Base for all SQLAlchemy custom mapped objects.
See also
BasicAttributes
AdvancedDeclarativeBase
AsyncAttrs
- class advanced_alchemy.base.UUIDAuditBase[source]¶
Bases:
CommonTableAttributes
,UUIDPrimaryKey
,AuditColumns
,AdvancedDeclarativeBase
,AsyncAttrs
Base for declarative models with UUID v4 primary keys and audit columns.
See also
CommonTableAttributes
advanced_alchemy.mixins.UUIDPrimaryKey
advanced_alchemy.mixins.AuditColumns
AdvancedDeclarativeBase
AsyncAttrs
- class advanced_alchemy.base.UUIDBase[source]¶
Bases:
UUIDPrimaryKey
,CommonTableAttributes
,AdvancedDeclarativeBase
,AsyncAttrs
Base for all SQLAlchemy declarative models with UUID v4 primary keys.
See also
advanced_alchemy.mixins.UUIDPrimaryKey
CommonTableAttributes
AdvancedDeclarativeBase
AsyncAttrs
- class advanced_alchemy.base.UUIDBaseT¶
Type variable for
UUIDBase
.alias of TypeVar(‘UUIDBaseT’, bound=
UUIDBase
)
- class advanced_alchemy.base.UUIDv6AuditBase[source]¶
Bases:
CommonTableAttributes
,UUIDv6PrimaryKey
,AuditColumns
,AdvancedDeclarativeBase
,AsyncAttrs
Base for declarative models with UUID v6 primary keys and audit columns.
See also
CommonTableAttributes
advanced_alchemy.mixins.UUIDv6PrimaryKey
advanced_alchemy.mixins.AuditColumns
AdvancedDeclarativeBase
AsyncAttrs
- class advanced_alchemy.base.UUIDv6Base[source]¶
Bases:
UUIDv6PrimaryKey
,CommonTableAttributes
,AdvancedDeclarativeBase
,AsyncAttrs
Base for all SQLAlchemy declarative models with UUID v6 primary keys.
See also
advanced_alchemy.mixins.UUIDv6PrimaryKey
CommonTableAttributes
AdvancedDeclarativeBase
AsyncAttrs
- class advanced_alchemy.base.UUIDv6BaseT¶
Type variable for
UUIDv6Base
.alias of TypeVar(‘UUIDv6BaseT’, bound=
UUIDv6Base
)
- class advanced_alchemy.base.UUIDv7AuditBase[source]¶
Bases:
CommonTableAttributes
,UUIDv7PrimaryKey
,AuditColumns
,AdvancedDeclarativeBase
,AsyncAttrs
Base for declarative models with UUID v7 primary keys and audit columns.
See also
CommonTableAttributes
advanced_alchemy.mixins.UUIDv7PrimaryKey
advanced_alchemy.mixins.AuditColumns
AdvancedDeclarativeBase
AsyncAttrs
- class advanced_alchemy.base.UUIDv7Base[source]¶
Bases:
UUIDv7PrimaryKey
,CommonTableAttributes
,AdvancedDeclarativeBase
,AsyncAttrs
Base for all SQLAlchemy declarative models with UUID v7 primary keys.
See also
advanced_alchemy.mixins.UUIDv7PrimaryKey
CommonTableAttributes
AdvancedDeclarativeBase
AsyncAttrs
- class advanced_alchemy.base.UUIDv7BaseT¶
Type variable for
UUIDv7Base
.alias of TypeVar(‘UUIDv7BaseT’, bound=
UUIDv7Base
)
- advanced_alchemy.base.convention: NamingSchemaParameter = {'ck': 'ck_%(table_name)s_%(constraint_name)s', 'fk': 'fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s', 'ix': 'ix_%(column_0_label)s', 'pk': 'pk_%(table_name)s', 'uq': 'uq_%(table_name)s_%(column_0_name)s'}¶
Templates for automated constraint name generation.
- advanced_alchemy.base.create_registry(custom_annotation_map: dict[Any, type[TypeEngine[Any]] | TypeEngine[Any]] | None = None) SQLAlchemyRegistry [source]¶
Create a new SQLAlchemy registry.
- advanced_alchemy.base.merge_table_arguments(cls: type[DeclarativeBase], table_args: TableArgsType | None = None) TableArgsType [source]¶
Merge Table Arguments.
When using mixins that include their own table args, it is difficult to append info into the model such as a comment.
This function helps you merge the args together.
- Parameters:
cls¶ –
sqlalchemy.orm.DeclarativeBase
This is the model that will get the table argstable_args¶ –
TableArgsType
additional information to add to table_args
- Returns:
TableArgsType
- advanced_alchemy.base.table_name_regexp = re.compile('((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z]))')¶
Regular expression for table name