mafw.db
Defines the DB interface and its public custom field types.
- class mafw.db.StorageField(checksum_field: str | None = None, *args: Any, **kwargs: Any)[source]
Bases:
TextFieldStore a physical path or logical reference in one self-describing text field.
Ordinary physical paths retain their legacy untagged representation. Paths beginning with the reserved
mafw:prefix are written with amafw:path:envelope. Logical references usemafw:logical:<volume>:<relative/path>. Incomplete or malformed reserved-looking values remain legacy physical paths; a complete unknown codec identifier raisesValueError.A string assigned in Python is always treated as a physical path. Assign a
LogicalFileReferenceobject for logical data. The codec never resolves paths or accesses a storage service.Automatic checksum propagation occurs only for physical values. For a logical value, provide a resolved physical path or an already computed checksum explicitly.
- Parameters:
checksum_field – Optional name of the associated checksum field.
Added in version 2.4.
Initialize a text field with an optional physical checksum association.
- accessor_class
alias of
StorageFieldAccessor
- db_value(value: str | Path | LogicalFileReference | None) str | None[source]
Serialize one physical or logical storage value.
- python_value(value: str | None) Path | LogicalFileReference | None[source]
Decode storage text into a physical path or logical reference.
- class mafw.db.StorageListField(checksum_field: str | None = None, *args: Any, **kwargs: Any)[source]
Bases:
StorageFieldStore an ordered, self-describing list of physical and logical values.
Values use the existing semicolon-separated text format. A physical list member containing
;is rejected because it cannot be represented unambiguously. Existing text is decoded using the historical split rule. SQL NULL and empty text both produce an empty list.- Parameters:
checksum_field – Optional name of the associated checksum field.
Added in version 2.4.
Initialize a text field with an optional physical checksum association.
- db_value(value: Iterable[str | Path | LogicalFileReference] | str | Path | LogicalFileReference | None) str | None[source]
Serialize list members in order without escaping legacy delimiters.
- python_value(value: str | None) list[Path | LogicalFileReference][source]
Decode a semicolon-separated list, preserving order and duplicates.
Modules
Module provides default configurations for different database engines. |
|
Database connection configuration helpers. |
|
Database filter module for MAFW. |
|
The module provides functionality to MAFw to interface to a DB. |
|
Database Type Definitions |
|
The module allows to generate a DB model structure starting from an existing DB. |
|
Module provides customised model fields specific for MAFw. |
|
Versioned database schema migration package. |
|
Module for registering and retrieving database models. |
|
Reflect database schemas into Python model modules. |
|
Module provides standard tables that are included in all database created by MAFw processor. |
|
Module provides a Trigger class and related tools to create triggers in the database via the ORM. |