versionalchemy.models package¶
-
class
versionalchemy.models.
VALogMixin
[source]¶ Bases:
object
A mixin providing the schema for the log table, an append only table which saves old versions of rows. An inheriting model must specify the following columns:
- user_id - a column corresponding to the user that made the specified change
- 1 or more columns which are a subset of columns in the user table. These columns
must have a unique constraint on the user table and also be named the same in both tables
-
classmethod
build_row_dict
(ut_row, session, deleted=False, user_id=None, use_dirty=True)[source]¶ Parameters: - ut_row – the row from the user table
- deleted – whether or not the row is deleted
- user_id – the user that is performing the update on this row
- use_dirty – whether to use the dirty fields from ut_row or not
Returns: a dictionary of key value pairs to be inserted into the archive table
Return type:
-
va_data
= Column(None, JSONEncodedDict(), table=None, nullable=False)¶
-
va_deleted
= Column(None, Boolean(), table=None, nullable=False)¶
-
va_id
= Column(None, Integer(), table=None, primary_key=True, nullable=False)¶
-
va_updated_at
= Column(None, DateTime(), table=None, nullable=False)¶
-
va_version
= Column(None, Integer(), table=None, nullable=False)¶
-
class
versionalchemy.models.
VAModelMixin
[source]¶ Bases:
object
-
classmethod
register
(ArchiveTable, engine)[source]¶ Parameters: - ArchiveTable – the model for the users archive table
- engine – the database engine
- version_col_names – strings which correspond to columns that versioning will pivot around. These columns must have a unique constraint set on them.
-
va_id
= Column(None, Integer(), table=None, nullable=False, default=ColumnDefault(0))¶
-
va_ignore_columns
= None¶
-
va_version_columns
= None¶
-
classmethod