pathwaycom/pathway · error · ValueError

Schema must be specified. Consider using `pw.schema_from_csv

Error message

Schema must be specified. Consider using `pw.schema_from_csv` for generating schema from a CSV file

What it means

Error "Schema must be specified. Consider using `pw.schema_from_csv` for generating schema from a CSV file" thrown in pathwaycom/pathway.

Source

Thrown at python/pathway/io/_utils.py:250

    schema: type[Schema],
) -> tuple[type[Schema], dict[str, Any]]:
    value_fields = _form_value_fields(schema)
    return schema, dict(
        # There is a distinction between an empty set of columns denoting
        # the primary key and None. If any (including empty) set of keys if provided,
        # then it will be used to compute the primary key.
        key_field_names=schema.primary_key_columns(),
        value_fields=value_fields,
    )


def assert_schema_not_none(
    schema: type[Schema] | None,
    data_format_type: str | None = None,
) -> type[Schema]:
    if schema is None:
        if data_format_type == "dsv":
            raise ValueError(
                "Schema must be specified. "
                "Consider using `pw.schema_from_csv` for generating schema from a CSV file"
            )
        else:
            raise ValueError("Schema must be specified.")
    else:
        return schema


class PlaintextKeySchema(pw.Schema):
    key: str


class RawKeySchema(pw.Schema):
    key: bytes


def construct_raw_data_schema_by_flags(

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Provide the schema explicitly via the schema parameter, or generate it with pw.schema_from_csv for CSV input.

Example fix

schema = pw.schema_from_csv('data.csv'); pw.io.csv.read('data.csv', schema=schema)

When it happens

Trigger: Thrown at python/pathway/io/_utils.py:250 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/3ded892d1ac6699c. Report an issue: GitHub.