pathwaycom/pathway · error · ValueError

Columns do not match between argument of Table.update_rows()

Error message

Columns do not match between argument of Table.update_rows() and the updated table.

What it means

Raised by Table.update_rows() when the argument table's column names differ from the updated table's. update_rows merges rows by id, so both tables must describe the same columns; unlike update_cells it does not report which columns mismatch, it just enforces key-set equality.

Source

Thrown at python/pathway/internals/table.py:1815

        ... 1 | 10  | Alice | 1
        ... 2 | 9   | Bob   | 1
        ... 3 | 8   | Alice | 2
        ... ''')
        >>> t2 = pw.debug.table_from_markdown('''
        ...    | age | owner | pet
        ... 1  | 10  | Alice | 30
        ... 12 | 12  | Tom   | 40
        ... ''')
        >>> t3 = t1.update_rows(t2)
        >>> pw.debug.compute_and_print(t3, include_id=False)
        age | owner | pet
        8   | Alice | 2
        9   | Bob   | 1
        10  | Alice | 30
        12  | Tom   | 40
        """
        if other.keys() != self.keys():
            raise ValueError(
                "Columns do not match between argument of Table.update_rows() and the updated table."
            )
        if self._universe.is_subset_of(other._universe):
            warnings.warn(
                "Universe of self is a subset of universe of other in update_rows. Returning other.",
                stacklevel=5,
            )
            return other

        schema = {}

        for key in self.keys():
            schema[key] = _types_lca_with_error(
                self.schema._dtypes()[key],
                other.schema._dtypes()[key],
                function_name="an update_rows",
                pointers=False,
            )

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Align the argument's columns: t1.update_rows(t2.select(*t1.keys()))
  2. Rename mismatched names first: t2 = t2.rename(**{'new_name': 'old_name'})
  3. Add missing columns to the base table with with_columns if they should be part of the schema
  4. Assert set(t1.keys()) == set(t2.keys()) in pipeline setup code to fail early with a clearer message

Example fix

# before
t3 = t1.update_rows(t2)  # t2 has extra column 'note'

# after
t3 = t1.update_rows(t2.select(*t1.keys()))
Defensive patterns

Strategy: validation

Validate before calling

def update_rows_safe(t1, t2):
    assert t1.keys() == t2.keys(), f'{set(t1.keys())} != {set(t2.keys())}'
    return t1.update_rows(t2)

Try / catch

try:
    t3 = t1.update_rows(t2)
except ValueError as e:
    if 'Columns do not match' in str(e):
        t3 = t1.update_rows(t2.select(*t1.keys()))

Prevention

When it happens

Trigger: t1.update_rows(t2) where t2.keys() != t1.keys(), e.g. t2 has an extra column, a missing column, or differently named columns.

Common situations: Merging rows from two connectors with drifting schemas; renaming one table only; passing a derived table (after with_columns/rename) as the update source.

Related errors


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