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

DEFAULT_CODE_VERSION module-attribute

DEFAULT_CODE_VERSION = '__metaxy_initial__'

SYSTEM_COLUMN_PREFIX module-attribute

SYSTEM_COLUMN_PREFIX = 'metaxy_'

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_FEATURE_VERSION module-attribute

METAXY_FEATURE_VERSION = f'{SYSTEM_COLUMN_PREFIX}feature_version'

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

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_FEATURE_SPEC_VERSION module-attribute

METAXY_FEATURE_SPEC_VERSION = f'{SYSTEM_COLUMN_PREFIX}feature_spec_version'

Hash of the complete feature specification (used for migration detection).

METAXY_FEATURE_TRACKING_VERSION module-attribute

METAXY_FEATURE_TRACKING_VERSION = f'{SYSTEM_COLUMN_PREFIX}feature_tracking_version'

Hash of feature dependencies and ID columns (tracks structural changes).

ALL_SYSTEM_COLUMNS module-attribute

All system-managed column names.

_DROPPABLE_COLUMNS module-attribute

Functions

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

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