Skip to content


name: str,
sample_rows: Optional[int]=None,
columns: Optional[list]=None,
columns_rename_mapping: Optional[dict]=None,
context_name: Optional[str]=None,
skip_entity_validation_checks: Optional[bool]=False,
primary_entities: Optional[List[str]]=None,
target_column: Optional[str]=None
) -> ObservationTable


Creates an ObservationTable from the View. When you specify the columns and the columns_rename_mapping parameters, make sure that the table has:

  • a column containing entity values with an accepted serving name.
  • a column containing historical points-in-time in UTC. The column name must be "POINT_IN_TIME".


  • name: str
    Name of the ObservationTable.

  • sample_rows: Optional[int]
    Optionally sample the source table to this number of rows before creating the observation table.

  • columns: Optional[list]
    Include only these columns in the view when creating the observation table. If None, all columns are included.

  • columns_rename_mapping: Optional[dict]
    Rename columns in the view using this mapping from old column names to new column names when creating the observation table. If None, no columns are renamed.

  • context_name: Optional[str]
    Context name for the observation table.

  • skip_entity_validation_checks: Optional[bool]
    default: False
    Skip entity validation checks when creating the observation table.

  • primary_entities: Optional[List[str]]
    List of primary entities for the observation table. If None, the primary entities are inferred from the view.

  • target_column: Optional[str]
    Name of the column in the observation table that stores the target values. The target column name must match an existing target namespace in the catalog. The data type and primary entities must match the those in the target namespace.


  • ObservationTable
    ObservationTable object.


  • ValueError
    If no primary entities are found.


>>> observation_table = view.create_observation_table(
...   name="<observation_table_name>",
...   sample_rows=10000,
...   columns=["timestamp", "<entity_serving_name>"],
...   columns_rename_mapping={"timestamp": "POINT_IN_TIME"},
...   context_id=context_id,
... )