{"record":{"id":"74f2072a9172384d","repo":"pathwaycom/pathway","slug":"the-primary-key-parameter-is-only-used-with-output","errorCode":null,"errorMessage":"The primary_key parameter is only used with output_table_type='snapshot'; remove it or set output_table_type='snapshot'.","messagePattern":"The primary_key parameter is only used with output_table_type='snapshot'; remove it or set output_table_type='snapshot'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/clickhouse/__init__.py","lineNumber":253,"sourceCode":"    )\n    reserved = metadata_columns & column_names\n    if reserved:\n        raise ValueError(\n            f\"Column name(s) {sorted(reserved)!r} collide with the reserved \"\n            f\"{sorted(metadata_columns)!r} metadata columns appended by \"\n            \"pw.io.clickhouse.write. Rename the column(s) in your schema before writing.\"\n        )\n    key_field_names: list[str] | None = None\n    if is_snapshot_mode:\n        if primary_key is None or not list(primary_key):\n            raise ValueError(\n                \"output_table_type='snapshot' requires the primary_key parameter: \"\n                \"pass the column(s) that identify each row so the connector can \"\n                \"maintain the current snapshot keyed by them.\"\n            )\n        key_field_names = [column.name for column in primary_key]\n    elif primary_key is not None:\n        raise ValueError(\n            \"The primary_key parameter is only used with output_table_type='snapshot'; \"\n            \"remove it or set output_table_type='snapshot'.\"\n        )\n\n    data_storage = api.DataStorage(\n        storage_type=\"clickhouse\",\n        connection_string=connection_string,\n        table_name=table_name,\n        max_batch_size=max_batch_size,\n        table_writer_init_mode=init_mode_from_str(init_mode),\n        snapshot_maintenance_on_output=is_snapshot_mode,\n    )\n    data_format = api.DataFormat(\n        format_type=\"identity\",\n        key_field_names=key_field_names if key_field_names is not None else [],\n        value_fields=_format_output_value_fields(table),\n    )\n","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/clickhouse/__init__.py#L235-L271","documentation":"Error \"The primary_key parameter is only used with output_table_type='snapshot'; remove it or set output_table_type='snapshot'.\" thrown in pathwaycom/pathway.","triggerScenarios":"Thrown at python/pathway/io/clickhouse/__init__.py:253 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the primary_key argument, or set output_table_type='snapshot'."],"exampleFix":"pw.io.clickhouse.write(t, ..., output_table_type='stream_of_changes')","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}