pathwaycom/pathway · error · ValueError
The primary_key parameter is only used with output_table_typ
Error message
The primary_key parameter is only used with output_table_type='snapshot'; remove it or set output_table_type='snapshot'.
What it means
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.
Source
Thrown at python/pathway/io/clickhouse/__init__.py:253
)
reserved = metadata_columns & column_names
if reserved:
raise ValueError(
f"Column name(s) {sorted(reserved)!r} collide with the reserved "
f"{sorted(metadata_columns)!r} metadata columns appended by "
"pw.io.clickhouse.write. Rename the column(s) in your schema before writing."
)
key_field_names: list[str] | None = None
if is_snapshot_mode:
if primary_key is None or not list(primary_key):
raise ValueError(
"output_table_type='snapshot' requires the primary_key parameter: "
"pass the column(s) that identify each row so the connector can "
"maintain the current snapshot keyed by them."
)
key_field_names = [column.name for column in primary_key]
elif primary_key is not None:
raise ValueError(
"The primary_key parameter is only used with output_table_type='snapshot'; "
"remove it or set output_table_type='snapshot'."
)
data_storage = api.DataStorage(
storage_type="clickhouse",
connection_string=connection_string,
table_name=table_name,
max_batch_size=max_batch_size,
table_writer_init_mode=init_mode_from_str(init_mode),
snapshot_maintenance_on_output=is_snapshot_mode,
)
data_format = api.DataFormat(
format_type="identity",
key_field_names=key_field_names if key_field_names is not None else [],
value_fields=_format_output_value_fields(table),
)
View on GitHub (pinned to fa2f74a464)
Solutions
- Remove the primary_key argument, or set output_table_type='snapshot'.
Example fix
pw.io.clickhouse.write(t, ..., output_table_type='stream_of_changes')
When it happens
Trigger: Thrown at python/pathway/io/clickhouse/__init__.py:253 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/74f2072a9172384d.
Report an issue: GitHub.