Model Transform
A ModelTransformConfig runs a secondary model
to produce input data for the parent model.
ModelTransformConfig — data source backed by a secondary modelling-language model.
- class ModelTransformConfig(file_key, file_name, debug_file=False)[source]
Data source that runs a secondary model and feeds its outputs back into the parent.
Inputs to the secondary model are registered via the
add_*_inputmethods.- Parameters:
- add_dynamic_values(timezone_key)[source]
Inject current-time/date variants as inputs.
- Parameters:
timezone_key (
Parameter|Calculation|None) – Optional model named value of typeSTRINGsupplying an IANA timezone for non-UTC time variants.- Return type:
- add_datastore_input(data_store_key, tables, model_filter=None, direct_data_pull=False)[source]
Register a data-store input feeding the secondary model.
- Return type:
- add_datastore_interface_input(data_store_key, tables, model_filter=None, direct_data_pull=False)[source]
Register a data-store-interface input feeding the secondary model.
- Return type:
- add_direct_upload_input(tables, missing_header_severity=ValidationSeverity.ERROR, unexpected_header_severity=ValidationSeverity.ERROR)[source]
Register a direct-upload (CSV) input feeding the secondary model.
missing_header_severityandunexpected_header_severitycontrol how header mismatches at upload time are surfaced; both default toValidationSeverity.ERROR.- Return type:
- property type: DataSourceType
The
DataSourceTypediscriminator for this configuration.
ModelTransform — wraps a sub-model used by ModelTransformConfig.
- class ModelTransform(model_builder)[source]
Sub-model that produces output tables consumed by a
ModelTransformConfig.- Parameters:
model_builder (
ModelBuilder) – The sub-model whose tables are mapped onto target-model tables viaadd_output_table().
Input subclasses for ModelTransformConfig.
Each subclass corresponds to a DataInputSourceType and emits the
appropriate sourceType discriminator on serialisation.
- class ModelTransformInput[source]
Abstract base for an input feeding a
ModelTransformConfig.- abstract property source_type: DataInputSourceType
The
DataInputSourceTypediscriminator.
- class DynamicValuesInput(timezone_key)[source]
Injects current-time/date values, optionally localised to
timezone_key.- property source_type: DataInputSourceType
The
DataInputSourceTypediscriminator.
- class DataStoreInput(data_store_key, tables, model_filter, direct_data_pull)[source]
Reads rows directly from a data store.
- property source_type: DataInputSourceType
The
DataInputSourceTypediscriminator.
- class DataStoreInterfaceInput(data_store_key, tables, model_filter, direct_data_pull)[source]
Reads rows through a data-store interface layer.
- property source_type: DataInputSourceType
The
DataInputSourceTypediscriminator.
- class DirectUploadInput(tables, missing_header_severity=ValidationSeverity.ERROR, unexpected_header_severity=ValidationSeverity.ERROR)[source]
Reads rows from a directly-uploaded CSV (or ZIP of CSVs).
Two header-validation severity controls are applied at upload time:
missing_header_severity— how to surface a header that the input expects but the uploaded data does not provide.unexpected_header_severity— how to surface a header present in the uploaded data that the input does not expect.
Both default to
ValidationSeverity.ERROR, matching the platform Java default. UseValidationSeverity.WARNINGto allow the upload to proceed while still displaying the issue, orValidationSeverity.IGNOREto suppress it entirely.- property source_type: DataInputSourceType
The
DataInputSourceTypediscriminator.
DataInputSourceType discriminator enum for ModelTransformInput.
- class DataInputSourceType(*values)[source]
Identifies the source of one input to a
ModelTransformConfig.- Values:
DATA_STORE: Rows pulled directly from a data store. DATA_STORE_INTERFACE: Rows pulled via a data-store interface. DYNAMIC_VALUES: Computed values such as the current time. DIRECT_UPLOAD: Rows from a CSV or zipped CSV upload.
- DATA_STORE = 'DATA_STORE'
- DATA_STORE_INTERFACE = 'DATA_STORE_INTERFACE'
- DYNAMIC_VALUES = 'DYNAMIC_VALUES'
- DIRECT_UPLOAD = 'DIRECT_UPLOAD'