Skip to content

featurebyte.SourceTable.create_event_table

create_event_table(
name: str,
event_timestamp_column: str,
event_id_column: str,
event_timestamp_timezone_offset: Union[str, NoneType]=None,
event_timestamp_timezone_offset_column: Union[str, NoneType]=None,
record_creation_timestamp_column: Union[str, NoneType]=None
) -> EventTable

Description

Creates and adds to the catalog an EventTable object from a source table where each row indicates a specific business event measured at a particular moment.

To create an EventTable, you need to identify the columns representing the event key and timestamp.

Additionally, the column that represents the record creation timestamp may be identified to enable an automatic analysis of data availability and freshness of the source table. This analysis can assist in selecting the default scheduling of the computation of features associated with the Event table (default FeatureJob setting).

After creation, the table can optionally incorporate additional metadata at the column level to further aid feature engineering. This can include identifying columns that identify or reference entities, providing information about the semantics of the table columns, specifying default cleaning operations, or furnishing descriptions of its columns.

Parameters

  • name: str
    The desired name for the new table.

  • event_timestamp_column: str
    The column that contains the timestamp of the associated event.

  • event_id_column: str
    The column that represents the unique identfier for each event.

  • event_timestamp_timezone_offset: Union[str, NoneType]
    Timezone offset for the event timestamp column. Supported format is "(+|-)HH:mm". Specify this if the timezone offset is a fixed value. Examples: "+08:00" or "-05:00".

  • event_timestamp_timezone_offset_column: Union[str, NoneType]
    Timezone offset column for the event timestamp column. The column is expected to have string type, and each value in the column is expected to have the format "(+|-)HH:mm". Specify this if the timezone offset is different for different rows in the event table.

  • record_creation_timestamp_column: Union[str, NoneType]
    The optional column for the timestamp when a record was created.

Returns

  • EventTable
    EventTable created from the source table.

Examples

Create an event table from a source table.

>>> # Register GroceryInvoice as an event data
>>> source_table = ds.get_source_table(
...   database_name="spark_catalog",
...   schema_name="GROCERY",
...   table_name="GROCERYINVOICE"
... )
>>> invoice_table = source_table.create_event_table(
...   name="GROCERYINVOICE",
...   event_id_column="GroceryInvoiceGuid",
...   event_timestamp_column="Timestamp",
...   record_creation_timestamp_column="record_available_at"
... )