apply() | FeatureStore Core Method | Teradata Package for Python - apply() - Teradata Package for Python

Teradata® Package for Python User Guide

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Teradata Package for Python
Release Number
20.00
Published
March 2025
ft:locale
en-US
ft:lastEdition
2025-12-05
dita:mapPath
nvi1706202040305.ditamap
dita:ditavalPath
plt1683835213376.ditaval
dita:id
rkb1531260709148
Product Category
Teradata Vantage

Use the apply() method to register objects to the repository.

  • If the object is an Entity or FeatureGroup and the same entity or feature group is already registered in the repository, it is not updated.
  • If the entity or feature group is associated with any feature process, an error is raised while modifying these objects.

Optional Parameter

object
Specifies the object to update the repository.

Example setup

>>> from teradataml import FeatureStore, DataFrame, load_example_data

Create a DataFrame on sales_data.

>>> from teradataml import FeatureStore, DataFrame, load_example_data

Create a FeatureStore for repo 'vfs_v1'.

>>> fs = FeatureStore("vfs_v1")
Repo vfs_v1 does not exist. Run FeatureStore.setup() to create the repo and setup FeatureStore.

Set up FeatureStore for this repository.

>>> fs.setup()
True

Example 1: Create a Feature for column 'Feb' from 'sales' DataFrame and register with repo 'vfs_v1'

Create a Feature.

>>> from teradataml import Feature
>>> feature = Feature('sales:Feb', df.Feb)

Register the Feature with the repo.

>>> fs.apply(feature)
True

Example 2: create Entity for 'sales' DataFrame and register with repo 'vfs_v1'

Create an Entity.

>>> from teradataml import Entity
>>> entity = Entity('sales:accounts', df.accounts)

Register the Entity with the repo.

>>> fs.apply(entity)
True

Example 3: create DataSource for 'sales' DataFrame and register with repo 'vfs_v1'

Create a DataSource.

>>> from teradataml import DataSource
>>> ds = DataSource('Sales_Data', df)

Register the DataSource with repo.

>>> fs.apply(ds)
True

Example 4: create FeatureStore with all the objects created in above examples and register with repo 'vfs_v1'

Create a FeatureGroup.

>>> from teradataml import FeatureGroup
>>> fg = FeatureGroup('Sales',
...                   features=feature,
...                   entity=entity,
...                   data_source=data_source)

Register the FeatureStore with the repo.

>>> fs.apply(fg)
True