Skip to content

featurebyte.View.create_observation_table

create_observation_table(
name: str,
sample_rows: Optional[int]=None,
columns: Optional[list[str]]=None,
columns_rename_mapping: Optional[dict[str, str]]=None
) -> ObservationTable

Description

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".

Parameters

  • 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[str]]
    Include only these columns in the view when creating the observation table. If None, all columns are included.

  • columns_rename_mapping: Optional[dict[str, str]]
    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.

Returns

  • ObservationTable
    ObservationTable object.

Examples

>>> 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"},
... )