pathwaycom/pathway · error · ValueError

ambiguous property; schema property `{property_name}` has va

Error message

ambiguous property; schema property `{property_name}` has value {schema_property!r} but column `{column_name}` got {column_property!r}

What it means

Column properties (e.g. append_only) can be set at schema level via schema_builder(properties=...) and per column via column_definition(...). When both are provided for the same property and their values differ, the property resolution in _get_column_property treats it as ambiguous and raises ValueError rather than silently picking one.

Source

Thrown at python/pathway/internals/schema.py:236

                f"type annotation of column `{column_name}` does not match column definition"
            )

        column_name = column.name or column_name

        def _get_column_property(property_name: str, default: Any) -> Any:
            match (
                getattr(column, property_name),
                getattr(schema_properties, property_name),
            ):
                case (None, None):
                    return default
                case (None, schema_property):
                    return schema_property
                case (column_property, None):
                    return column_property
                case (column_property, schema_property):
                    if column_property != schema_property:
                        raise ValueError(
                            f"ambiguous property; schema property `{property_name}` has"
                            + f" value {schema_property!r} but column"
                            + f" `{column_name}` got {column_property!r}"
                        )
                    return column_property

        columns[column_name] = ColumnSchema(
            primary_key=column.primary_key,
            default_value=column.default_value,
            dtype=dt.wrap(dtype),
            name=column_name,
            append_only=_get_column_property("append_only", False),
            description=column.description,
            example=column.example,
            source_component=column.source_component,
        )

    if fields:

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Remove the conflict: set the property either at schema level or on the column, not both with different values.
  2. If a column genuinely needs a different value than the schema default, make all other columns consistent or omit the schema-level property.
  3. Equal values on both levels are fine — only differing values raise; align them.

Example fix

# before
cols = {"v": pw.column_definition(dtype=int, append_only=False)}
S = pw.schema_builder(columns=cols, properties=pw.SchemaProperties(append_only=True))

# after
cols = {"v": pw.column_definition(dtype=int)}
S = pw.schema_builder(columns=cols, properties=pw.SchemaProperties(append_only=True))
Defensive patterns

Strategy: validation

Validate before calling

from dataclasses import fields

def properties_consistent(column, schema_properties) -> bool:
    for prop in ("append_only",):
        c, s = getattr(column, prop, None), getattr(schema_properties, prop, None)
        if c is not None and s is not None and c != s:
            return False
    return True

Prevention

When it happens

Trigger: pw.schema_builder(columns={...}, properties=SchemaProperties(append_only=True)) while a column in that schema declares column_definition(append_only=False), or vice versa with any conflicting property value.

Common situations: Setting a global schema property then overriding one column with a different value; composing schemas via | where one side carries conflicting properties.

Related errors


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/5cab4f8f679a1447. Report an issue: GitHub.