Skip to navigation

Kumo Relational uses table-level time metadata to construct context as it existed at a prediction boundary. A column can have a timestamp data type and the timestamp semantic type without being designated as the table’s time_column.

time_column identifies when a row became available to the prediction workflow. Set it only when the column represents the table’s own timeline. An administrative timestamp such as a last-modified date does not necessarily serve that role.

Choose the Appropriate Column

The following table shows which column to use as time_column for each table pattern:

Table patterntime_column
Event or transaction tableThe event timestamp
Entity or lookup tableThe entity creation timestamp, when available; otherwise unset

For example, an order table can use its order timestamp as time_column.

sdm_client.Table has no end_time_column. If your data models row validity with a start and an end (a versioned or validity-tracked table), you can declare only the start as the table’s timeline today. There is no supported way to also declare when a row stopped being valid.

How Inference Chooses a Time Column

Inference reads the whole table and applies a rule, not only a name match. It does not take the following columns:

  • A timestamp column that is empty in more than half the rows.
  • One holding a single value everywhere it holds any, unless the table has one row.
  • One named for when a row was loaded or synced.
  • A date of birth.
  • A last-edit stamp such as ModifiedDate, on a table another table links to (it can still be taken on a table nothing links to, if it is the only timestamp candidate left).

Of several remaining candidates, a column named like created/created_at wins. Otherwise, inference chooses the candidate whose values start earliest, ignoring placeholder dates such as 1900-01-01 and 1970-01-01. A column that cannot be read stays a candidate rather than being discarded.

Behavior During Sampling

time_column participates in temporal neighbor sampling, so a future row relative to the prediction anchor is not sampled into context. The anchor_time prediction setting selects the reference time used for a request. Refer to Set the anchor time.

Configure the Time Column

To configure the time column, build the schema, inspect the inferred metadata, and correct each table as needed:

from sdm_client import Schema
schema = Schema.from_data({"customers": customers, "orders": orders})
schema["orders"].time_column = "order_time"

Schema.from_data() and Schema.from_source() both take time_columns= to set them at build time:

schema = Schema.from_data(
{"customers": customers, "orders": orders},
time_columns={"orders": "order_time"},
)

Pass time_columns={"orders": None} to say a table has no time column, overriding inference, on either builder.

Setting time_column also marks that column’s semantic type as timestamp. The SDK rejects an incompatible physical data type. A table’s primary key and time column must be different columns.

After making changes, call schema.check_consistent(). Refer to Configure Table Metadata for the complete metadata workflow.

Best Practices

Confirm the following for the time column:

  • The time column represents when a row became available, not merely when it was edited.
  • The source column uses a consistent, unambiguous datetime representation.
  • The same column is not assigned as both the primary key and the time column.
  • The schema is checked with schema.check_consistent() after any correction.