pathwaycom/pathway · error · ValueError

the designated_timestamp column {designated_timestamp.name!r

Error message

the designated_timestamp column {designated_timestamp.name!r} must have type DateTimeNaive or DateTimeUtc, but it has type {timestamp_dtype}

What it means

Raised by pw.io.questdb.write when the column passed as designated_timestamp is typed anything other than dt.DATE_TIME_NAIVE or dt.DATE_TIME_UTC. QuestDB's designated timestamp is a native TIMESTAMP column, so int/float epoch columns, dates, or strings cannot be used directly and must be converted to a Pathway datetime type first.

Source

Thrown at python/pathway/io/questdb/__init__.py:149

    And see the contents of the table.
    """
    _check_entitlements("questdb")

    designated_timestamp_index = None
    if designated_timestamp is not None:
        if (
            designated_timestamp_policy is not None
            and designated_timestamp_policy != "use_column"
        ):
            raise ValueError(
                f"designated_timestamp is passed, but designated_timestamp_policy is {designated_timestamp_policy}"
            )
        designated_timestamp_policy = "use_column"
        designated_timestamp_index = get_column_index(table, designated_timestamp)
        timestamp_dtype = table.schema.columns()[designated_timestamp.name].dtype
        if timestamp_dtype not in (dt.DATE_TIME_NAIVE, dt.DATE_TIME_UTC):
            raise ValueError(
                f"the designated_timestamp column {designated_timestamp.name!r} must have "
                f"type DateTimeNaive or DateTimeUtc, but it has type {timestamp_dtype}"
            )
    elif designated_timestamp_policy == "use_column":
        raise ValueError(
            'designated_timestamp_policy="use_column" requires the '
            "designated_timestamp parameter to be set"
        )
    elif designated_timestamp_policy is None:
        designated_timestamp_policy = "use_now"

    data_storage = api.DataStorage(
        storage_type="questdb",
        path=connection_string,
        table_name=table_name,
        key_field_index=designated_timestamp_index,
    )
    data_format = api.DataFormat(

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Convert the column: t = t.with_columns(ts=pw.this.ts.dt.from_epoch_millisecond()) (or the appropriate strptime/utc conversion) so it becomes DateTimeNaive/DateTimeUtc.
  2. Or declare the field as datetime in the schema and parse at ingest so it never lands as int/str.
  3. If the data is genuinely date-only, do not use it as designated timestamp — omit the parameter and let QuestDB use now().

Example fix

# before
# ts: int  (epoch millis)
pw.io.questdb.write(t, conn, "t", designated_timestamp=t.ts)

# after
t = t.with_columns(ts=pw.this.ts.dt.from_epoch_millisecond())
pw.io.questdb.write(t, conn, "t", designated_timestamp=t.ts)
Defensive patterns

Strategy: validation

Validate before calling

ts_dtype = t.schema.columns()[t.ts.name].dtype
assert ts_dtype in (dt.DATE_TIME_NAIVE, dt.DATE_TIME_UTC), f"bad ts dtype: {ts_dtype}"
pw.io.questdb.write(t, conn, "t", designated_timestamp=t.ts)

Type guard

def is_datetime_column(ref) -> bool:
    from pathway import dt
    return ref._column.dtype in (dt.DATE_TIME_NAIVE, dt.DATE_TIME_UTC)

Prevention

When it happens

Trigger: pw.io.questdb.write(t, conn, 't', designated_timestamp=t.ts) where the schema declares ts: int (epoch millis), ts: float, ts: str (ISO strings), or a Date type — anything but DateTimeNaive/DateTimeUtc.

Common situations: Ingesting epoch-millisecond columns from JSON/CSV where numbers stay ints; ISO-8601 string columns parsed later; a Date-only field used as timestamp; unit confusion between naive and UTC datetimes.

Related errors


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/f28a65162112fd93. Report an issue: GitHub.