Use the ingest_features() method to ingest the features from a feature group. ingest_features() considers the associated DataSource as the data source for the feature process and ingests the feature values in the feature catalog.
Required Parameter
- repo
- Specifies the name of the repository to ingest the features.
Optional Parameter
- data_domain
- Specifies the name of the data domain to ingest the features for.
Example setup
>>> load_example_data('dataframe', ['sales'])
>>> df = DataFrame("sales")
>>> from teradataml import FeatureStore
>>> fs = FeatureStore("vfs_v1", data_domain='sales')
Repo vfs_v1 does not exist. Run FeatureStore.setup() to create the repo and setup FeatureStore.
>>> fs.setup()
True
Example 1: create a FeatureGroup 'sales_data_fg' for above mentioned DataFrame and publish it to 'vfs_v1'
Create the features.
>>> jan_feature = Feature("sales:Jan", df.Jan)
>>> feb_feature = Feature("sales:Fan", df.Feb)
>>> mar_feature = Feature("sales:Mar", df.Mar)
>>> apr_feature = Feature("sales:Apr", df.Apr)
Create an entity.
>>> entity = Entity("sales:accounts", df.accounts)
Create a data source.
>>> data_source = DataSource("sales_source", df.show_query())
Create a feature group.
>>> fg = FeatureGroup('Sales',
... features=[jan_feature, feb_feature, mar_feature, apr_feature],
... entity=entity,
... data_source=data_source)
Ingest the features.
>>> fp = fg.ingest_features()
Process 'e04fd157-6c23-11f0-8bd4-f020ffe7fe09' started. Process 'e04fd157-6c23-11f0-8bd4-f020ffe7fe09' completed.
>>> fp
FeatureProcess(repo=vfs_v1, data_domain=sales, process_id=e04fd157-6c23-11f0-8bd4-f020ffe7fe09)