featurebyte.ViewColumn.as_target¶
as_target(
target_name: str,
offset: Union[str, NoneType]=None
) -> TargetDescription¶
Create a lookup target directly from the column in the View. For SCD views, lookup targets are materialized through point-in-time joins, and the resulting value represents the active row for the natural key at the point-in-time indicated in the target request.
To obtain a target value at a specific time before the request's point-in-time, an offset can be specified.
Parameters¶
- target_name: str
Name of the target to create. - offset: Union[str, NoneType]
When specified, retrieve target value as of this offset prior to the point-in-time.
Returns¶
- Target
Examples¶
>>> customer_view = catalog.get_view("GROCERYCUSTOMER")
>>> # Extract operating system from BrowserUserAgent column
>>> customer_view["OperatingSystemIsWindows"] = customer_view.BrowserUserAgent.str.contains("Windows")
>>> # Create a target from the OperatingSystemIsWindows column
>>> uses_windows = customer_view.OperatingSystemIsWindows.as_target("UsesWindows")