{"record":{"id":"d4b8c609b1387339","repo":"pathwaycom/pathway","slug":"columns-do-not-match-between-argument-of-table-upd","errorCode":null,"errorMessage":"Columns do not match between argument of Table.update_rows() and the updated table.","messagePattern":"Columns do not match between argument of Table\\.update_rows\\(\\) and the updated table\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/internals/table.py","lineNumber":1815,"sourceCode":"        ... 1 | 10  | Alice | 1\n        ... 2 | 9   | Bob   | 1\n        ... 3 | 8   | Alice | 2\n        ... ''')\n        >>> t2 = pw.debug.table_from_markdown('''\n        ...    | age | owner | pet\n        ... 1  | 10  | Alice | 30\n        ... 12 | 12  | Tom   | 40\n        ... ''')\n        >>> t3 = t1.update_rows(t2)\n        >>> pw.debug.compute_and_print(t3, include_id=False)\n        age | owner | pet\n        8   | Alice | 2\n        9   | Bob   | 1\n        10  | Alice | 30\n        12  | Tom   | 40\n        \"\"\"\n        if other.keys() != self.keys():\n            raise ValueError(\n                \"Columns do not match between argument of Table.update_rows() and the updated table.\"\n            )\n        if self._universe.is_subset_of(other._universe):\n            warnings.warn(\n                \"Universe of self is a subset of universe of other in update_rows. Returning other.\",\n                stacklevel=5,\n            )\n            return other\n\n        schema = {}\n\n        for key in self.keys():\n            schema[key] = _types_lca_with_error(\n                self.schema._dtypes()[key],\n                other.schema._dtypes()[key],\n                function_name=\"an update_rows\",\n                pointers=False,\n            )","sourceCodeStart":1797,"sourceCodeEnd":1833,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/internals/table.py#L1797-L1833","documentation":"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.","triggerScenarios":"t1.update_rows(t2) where t2.keys() != t1.keys(), e.g. t2 has an extra column, a missing column, or differently named columns.","commonSituations":"Merging rows from two connectors with drifting schemas; renaming one table only; passing a derived table (after with_columns/rename) as the update source.","solutions":["Align the argument's columns: t1.update_rows(t2.select(*t1.keys()))","Rename mismatched names first: t2 = t2.rename(**{'new_name': 'old_name'})","Add missing columns to the base table with with_columns if they should be part of the schema","Assert set(t1.keys()) == set(t2.keys()) in pipeline setup code to fail early with a clearer message"],"exampleFix":"# before\nt3 = t1.update_rows(t2)  # t2 has extra column 'note'\n\n# after\nt3 = t1.update_rows(t2.select(*t1.keys()))","handlingStrategy":"validation","validationCode":"def update_rows_safe(t1, t2):\n    assert t1.keys() == t2.keys(), f'{set(t1.keys())} != {set(t2.keys())}'\n    return t1.update_rows(t2)","typeGuard":null,"tryCatchPattern":"try:\n    t3 = t1.update_rows(t2)\nexcept ValueError as e:\n    if 'Columns do not match' in str(e):\n        t3 = t1.update_rows(t2.select(*t1.keys()))","preventionTips":["Share one Schema class across all update_rows participants","Project to matching columns before update_rows","Note update_rows returns `other` with a warning when self is a subset — check logs"],"tags":["pathway","schema","update-rows","columns"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}