Transformations
Overviewβ
A transformation is a function that specifies logic to run against data retrieved from external data sources.
By default, transformations are inlined into Feature Views.
The following example shows a Feature View that implements a transformation in
the body of the Feature View function my_feature_view
. The transformation runs
in spark_sql
mode and renames columns from the data source to feature_one
and feature_two
.
@batch_feature_view(
mode="spark_sql",
# ...
)
def my_feature_view(input_data):
return f"""
SELECT
entity_id,
timestamp,
column_a AS feature_one,
column_b AS feature_two
FROM {input_data}
"""
Alternatively, transformations can be
defined outside of Feature Views
in Tecton objects identified with the @transformation
decorator. This allows
transformations to be modular, discoverable in Tecton's Web UI, and reusable
across multiple Feature Views.
Transformation input and outputβ
Inputβ
The input to a transformation contains the columns in the data source.