@@ -73,19 +73,24 @@ Background reading to understand the concepts of Feature Store and OCI Data Scie
7373
7474
7575 # step2: Create feature store
76- def transactions_df(dataframe):
76+ def transactions_df(dataframe, **kwargs):
77+ columns = kwargs.get('columns', '*') # Default to select all columns if 'columns' not provided
78+ where_clause = kwargs.get('where_clause', '') # Default to empty where clause if 'where_clause' not provided
79+
7780 sql_query = f"""
7881 SELECT
79- col1,
80- col2
82+ {columns}
8183 FROM
82- {dataframe}
84+ {table_name}
85+ {where_clause}
8386 """
8487 return sql_query
8588
89+ transformation = feature_store.create_transformation(
90+ transformation_mode=TransformationMode.SQL,
91+ source_code_func=transactions_df
92+ )
8693
87- transformation = feature_store.create_transformation(transformation_mode=TransformationMode.SQL,
88- source_code_func=transactions_df)
8994
9095 # step3: Create expectation
9196 expectation_suite = ExpectationSuite(expectation_suite_name="feature_definition")
@@ -102,14 +107,17 @@ Background reading to understand the concepts of Feature Store and OCI Data Scie
102107 stats_config = StatisticsConfig().with_is_enabled(False)
103108
104109 # step5: Create feature group
110+ transformation_args = {"columns": "col1, col2", "where_clause": "col3 > 100"}
105111 feature_group = entity.create_feature_group(
106- ["name"],
112+ primary_keys=["name"],
113+ partition_keys=["name"],
107114 input_feature_details,
108- expectation_suite,
109- ExpectationType.LENIENT,
110- stats_config,
115+ expectation_suite=expectation_suite ,
116+ expectation_type= ExpectationType.LENIENT,
117+ statistics_config= stats_config,
111118 name="<feature_group_name>",
112- transformation_id=transformation.id
119+ transformation_id=transformation.id,
120+ transformation_kwargs=transformation_args
113121 )
114122
115123
0 commit comments