Skip to content

Constants

Constants

Shared constants for system-managed column names.

All system columns use the metaxy_ prefix to avoid conflicts with user columns.

Attributes

metaxy.models.constants.DEFAULT_CODE_VERSION module-attribute

DEFAULT_CODE_VERSION = '__metaxy_initial__'

metaxy.models.constants.SYSTEM_COLUMN_PREFIX module-attribute

SYSTEM_COLUMN_PREFIX = 'metaxy_'

metaxy.models.constants.METAXY_PROVENANCE_BY_FIELD module-attribute

METAXY_PROVENANCE_BY_FIELD = f'{SYSTEM_COLUMN_PREFIX}provenance_by_field'

Field-level provenance hashes (struct column mapping field names to hashes).

metaxy.models.constants.METAXY_PROVENANCE module-attribute

METAXY_PROVENANCE = f'{SYSTEM_COLUMN_PREFIX}provenance'

Hash ofmetaxy_provenance_by_field -- a single string value.

metaxy.models.constants.METAXY_FEATURE_VERSION module-attribute

METAXY_FEATURE_VERSION = f'{SYSTEM_COLUMN_PREFIX}feature_version'

Hash of the feature definition (dependencies + fields + code_versions).

metaxy.models.constants.METAXY_SNAPSHOT_VERSION module-attribute

METAXY_SNAPSHOT_VERSION = f'{SYSTEM_COLUMN_PREFIX}snapshot_version'

Hash of the entire feature graph snapshot (recorded during deployment).

metaxy.models.constants.METAXY_FEATURE_SPEC_VERSION module-attribute

METAXY_FEATURE_SPEC_VERSION = f'{SYSTEM_COLUMN_PREFIX}feature_spec_version'

Hash of the complete feature specification.

metaxy.models.constants.METAXY_FULL_DEFINITION_VERSION module-attribute

METAXY_FULL_DEFINITION_VERSION = f'{SYSTEM_COLUMN_PREFIX}full_definition_version'

Hash of the complete feature definition including Pydantic schema, feature spec, and project.

This comprehensive hash captures ALL aspects of a feature definition: - Pydantic model schema (field types, descriptions, validators, serializers, etc.) - Feature specification (dependencies, fields, code_versions, metadata) - Project name

Used in system tables to detect when ANY part of a feature changes.

metaxy.models.constants.METAXY_DATA_VERSION_BY_FIELD module-attribute

METAXY_DATA_VERSION_BY_FIELD = f'{SYSTEM_COLUMN_PREFIX}data_version_by_field'

Field-level data version hashes (struct column mapping field names to version hashes).

Similar to provenance_by_field, but can be user-overridden to implement custom versioning (e.g., content hashes, timestamps, semantic versions).

metaxy.models.constants.METAXY_DATA_VERSION module-attribute

METAXY_DATA_VERSION = f'{SYSTEM_COLUMN_PREFIX}data_version'

Hash of metaxy_data_version_by_field -- a single string value.

metaxy.models.constants.METAXY_CREATED_AT module-attribute

METAXY_CREATED_AT = f'{SYSTEM_COLUMN_PREFIX}created_at'

Timestamp when the metadata row was created.

metaxy.models.constants.METAXY_MATERIALIZATION_ID module-attribute

METAXY_MATERIALIZATION_ID = f'{SYSTEM_COLUMN_PREFIX}materialization_id'

External orchestration run ID (e.g., Dagster Run ID, Airflow Run ID) for tracking pipeline executions.

metaxy.models.constants.ALL_SYSTEM_COLUMNS module-attribute

All Metaxy-managed column names that are injected into feature tables.

metaxy.models.constants._DROPPABLE_COLUMNS module-attribute

metaxy.models.constants.SYSTEM_COLUMNS_WITH_LINEAGE module-attribute

Functions

metaxy.models.constants.is_system_column

is_system_column(name: str) -> bool

Check whether a column name is a system-managed column.

Parameters:

  • name (str) –

    Column name to check

Returns:

  • bool

    True if the column is a system column, False otherwise

Examples:

>>> is_system_column("metaxy_feature_version")
True
>>> is_system_column("my_column")
False
Source code in src/metaxy/models/constants.py
def is_system_column(name: str) -> bool:
    """Check whether a column name is a system-managed column.

    Args:
        name: Column name to check

    Returns:
        True if the column is a system column, False otherwise

    Examples:
        >>> is_system_column("metaxy_feature_version")
        True
        >>> is_system_column("my_column")
        False
    """
    return name in ALL_SYSTEM_COLUMNS

metaxy.models.constants.is_droppable_system_column

is_droppable_system_column(name: str) -> bool

Check whether a column should be dropped when joining upstream features.

Droppable columns (feature_version, snapshot_version) are recalculated for each feature, so keeping them from upstream would cause conflicts.

Parameters:

  • name (str) –

    Column name to check

Returns:

  • bool

    True if the column should be dropped during joins, False otherwise

Examples:

>>> is_droppable_system_column("metaxy_feature_version")
True
>>> is_droppable_system_column("metaxy_provenance_by_field")
False
Source code in src/metaxy/models/constants.py
def is_droppable_system_column(name: str) -> bool:
    """Check whether a column should be dropped when joining upstream features.

    Droppable columns (feature_version, snapshot_version) are recalculated for
    each feature, so keeping them from upstream would cause conflicts.

    Args:
        name: Column name to check

    Returns:
        True if the column should be dropped during joins, False otherwise

    Examples:
        >>> is_droppable_system_column("metaxy_feature_version")
        True
        >>> is_droppable_system_column("metaxy_provenance_by_field")
        False
    """
    return name in _DROPPABLE_COLUMNS