base¶
Application ORM configuration.
- class advanced_alchemy.base.AuditColumns[source]¶
Bases:
object
Created/Updated At Fields Mixin.
- class advanced_alchemy.base.BigIntAuditBase[source]¶
Bases:
CommonTableAttributes
,BigIntPrimaryKey
,AuditColumns
,DeclarativeBase
Base for declarative models with BigInt primary keys and audit columns.
- __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
- registry: ClassVar[_RegistryType] = <sqlalchemy.orm.decl_api.registry object>¶
Refers to the
_orm.registry
in use where new_orm.Mapper
objects will be associated.
- class advanced_alchemy.base.BigIntBase[source]¶
Bases:
BigIntPrimaryKey
,CommonTableAttributes
,DeclarativeBase
Base for all SQLAlchemy declarative models with BigInt primary keys.
- __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
- registry: ClassVar[_RegistryType] = <sqlalchemy.orm.decl_api.registry object>¶
Refers to the
_orm.registry
in use where new_orm.Mapper
objects will be associated.
- class advanced_alchemy.base.BigIntPrimaryKey[source]¶
Bases:
object
BigInt Primary Key Field Mixin.
- id¶
BigInt Primary key column.
- class advanced_alchemy.base.CommonTableAttributes[source]¶
Bases:
BasicAttributes
Common attributes for SQLALchemy tables.
- advanced_alchemy.base.create_registry(custom_annotation_map: dict[Any, type[TypeEngine[Any]] | TypeEngine[Any]] | None = None) registry [source]¶
Create a new SQLAlchemy registry.
- class advanced_alchemy.base.ModelProtocol[source]¶
Bases:
Protocol
The base SQLAlchemy model protocol.
- __init__(*args, **kwargs)¶
- class advanced_alchemy.base.UUIDAuditBase[source]¶
Bases:
CommonTableAttributes
,UUIDPrimaryKey
,AuditColumns
,DeclarativeBase
Base for declarative models with UUID primary keys and audit columns.
- 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.UUIDBase[source]¶
Bases:
UUIDPrimaryKey
,CommonTableAttributes
,DeclarativeBase
Base for all SQLAlchemy declarative models with UUID primary keys.
- 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.UUIDv6AuditBase[source]¶
Bases:
CommonTableAttributes
,UUIDv6PrimaryKey
,AuditColumns
,DeclarativeBase
Base for declarative models with UUID primary keys and audit columns.
- 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.UUIDv6Base[source]¶
Bases:
UUIDv6PrimaryKey
,CommonTableAttributes
,DeclarativeBase
Base for all SQLAlchemy declarative models with UUID primary keys.
- 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.UUIDv7AuditBase[source]¶
Bases:
CommonTableAttributes
,UUIDv7PrimaryKey
,AuditColumns
,DeclarativeBase
Base for declarative models with UUID primary keys and audit columns.
- 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.UUIDv7Base[source]¶
Bases:
UUIDv7PrimaryKey
,CommonTableAttributes
,DeclarativeBase
Base for all SQLAlchemy declarative models with UUID primary keys.
- 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.NanoIDAuditBase[source]¶
Bases:
CommonTableAttributes
,NanoIDPrimaryKey
,AuditColumns
,DeclarativeBase
Base for declarative models with Nano ID primary keys and audit columns.
- __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
- registry: ClassVar[_RegistryType] = <sqlalchemy.orm.decl_api.registry object>¶
Refers to the
_orm.registry
in use where new_orm.Mapper
objects will be associated.
- class advanced_alchemy.base.NanoIDBase[source]¶
Bases:
NanoIDPrimaryKey
,CommonTableAttributes
,DeclarativeBase
Base for all SQLAlchemy declarative models with Nano ID primary keys.
- __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
- registry: ClassVar[_RegistryType] = <sqlalchemy.orm.decl_api.registry object>¶
Refers to the
_orm.registry
in use where new_orm.Mapper
objects will be associated.
- class advanced_alchemy.base.UUIDv7PrimaryKey[source]¶
Bases:
object
UUID v7 Primary Key Field Mixin.
- class advanced_alchemy.base.UUIDv6PrimaryKey[source]¶
Bases:
object
UUID v6 Primary Key Field Mixin.
- class advanced_alchemy.base.SQLQuery[source]¶
Bases:
BasicAttributes
,DeclarativeBase
Base for all SQLAlchemy custom mapped objects.
- __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
- registry: ClassVar[_RegistryType] = <sqlalchemy.orm.decl_api.registry object>¶
Refers to the
_orm.registry
in use where new_orm.Mapper
objects will be associated.
- advanced_alchemy.base.merge_table_arguments(cls: type[sqlalchemy.orm.decl_api.DeclarativeBase], table_args: Tuple[Any, ...] | Dict[str, Any] | None = None) Tuple[Any, ...] | Dict[str, Any] [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.