Skip to content

Commit b30f09a

Browse files
committed
updated doc for the kwargs and partiton keys
1 parent d41e081 commit b30f09a

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

ads/feature_store/docs/source/feature_group.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,19 @@ A ``FeatureGroup`` instance will be created.
1818
:caption: Python
1919

2020
from ads.feature_store.feature_group import FeatureGroup
21+
# Dictionary containing arguments for the feature group for the transformation function.
22+
transformation_kwargs = {}
2123

2224
feature_group_flights = (
2325
FeatureGroup()
2426
.with_feature_store_id(feature_store.id)
2527
.with_primary_keys(["col1"])
28+
.with_partition_keys(["col1", "col2"])
2629
.with_name("flights_feature_group")
2730
.with_entity_id("<entity_id>")
2831
.with_compartment_id("ocid1.compartment..<unique_id>")
2932
.with_schema_details_from_dataframe(dataframe)
33+
.with_transformation_kwargs(transformation_kwargs)
3034
)
3135

3236
.. code-tab:: Python3
@@ -52,6 +56,9 @@ A ``FeatureGroup`` instance will be created.
5256
primaryKeys:
5357
items:
5458
- name: col1
59+
partitionKeys:
60+
items:
61+
- name: col1
5562
statisticsConfig:
5663
isEnabled: true
5764
type: featureGroup

ads/feature_store/docs/source/quickstart.rst

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)