{"record":{"id":"69e0510c0579883f","repo":"pathwaycom/pathway","slug":"only-one-column-from-a-table-can-be-used-in-a-sync","errorCode":null,"errorMessage":"Only one column from a table can be used in a synchronization group","messagePattern":"Only one column from a table can be used in a synchronization group","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/_synchronization.py","lineNumber":291,"sourceCode":"        if column_idx is None:\n            raise ValueError(\n                f\"Failed to find the column '{column._name}' in table {column._table}\"\n            )\n\n        is_table_found = False\n        for node in G._current_scope.nodes:\n            if (\n                not isinstance(node, InputOperator)\n                or not isinstance(node.datasource, GenericDataSource)\n                or node.outputs[0].value != column._table\n            ):\n                continue\n            is_table_found = True\n            group = api.ConnectorGroupDescriptor(\n                name, column_idx, max_difference, priority, idle_duration\n            )\n            if node.datasource.data_source_options.synchronization_group is not None:\n                raise ValueError(\n                    \"Only one column from a table can be used in a synchronization group\"\n                )\n            node.datasource.data_source_options.set_synchronization_group(group)\n            break\n\n        if not is_table_found:\n            raise ValueError(\n                \"Only unchanged columns of an input tables can be used in input synchronization groups\"\n            )\n\n    if len(column_types) > 1:\n        raise ValueError(\n            \"All synchronization group column types must coincide. \"\n            \"However several types have been detected: {}\".format(\n                \", \".join(sorted([f\"'{t}'\" for t in column_types]))\n            )\n        )\n","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/_synchronization.py#L273-L309","documentation":"ValueError raised when the synchronization code finds an InputOperator for the column's table whose data source already has a synchronization_group assigned. Each input table (connector) can contribute at most one column to synchronization groups, because the group is attached to the data source options, not per column.","triggerScenarios":"Calling sync() twice with different columns of the same table: sync(t.a, u.x, ...) then sync(t.b, v.y, ...); or passing two columns of the same table in one call. The second assignment hits data_source_options.synchronization_group is not None.","commonSituations":"Trying to synchronize two connectors by two different time keys of the same source (e.g. created_at and updated_at); composing multiple sync groups in a larger pipeline where one table appears twice; refactoring that accidentally duplicates a table's column into another group.","solutions":["Use only one column per table across all synchronization groups; pick the primary timestamp (e.g. unix_timestamp)","If a second key of the same source must be synchronized, feed that source through a second independent connector/table","Audit all sync() calls and ensure no table contributes more than one column reference"],"exampleFix":"// before\npw.io.synchronize(t.created_at, u.time, max_difference=60)\npw.io.synchronize(t.updated_at, v.time, max_difference=60)  # ValueError: same table twice\n\n// after\npw.io.synchronize(t.created_at, u.time, v.time, max_difference=60)","handlingStrategy":"validation","validationCode":"from collections import Counter\n\ndef validate_one_column_per_table(columns) -> None:\n    tables = Counter(c._table for c in columns)\n    dupes = [t for t, n in tables.items() if n > 1]\n    if dupes:\n        raise ValueError(f'tables used with more than one sync column: {dupes}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Track which tables already joined a sync group in pipeline builders","Design one timestamp key per connector for synchronization","Add a lint/test pass asserting each input table appears in at most one group"],"tags":["pathway","io","synchronization","connectors","validation"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}