upload_features() | FeatureCatalog Method | Teradata Package for Python - upload_features() - 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 upload_features() method to upload the features in to feature catalog from the DataFrame.

Required Parameter

object
Specifies the source to ingest feature values. It can be one of the following:
  • teradataml DataFrame
  • Feature group
  • Process id
  • If object is of type teradataml DataFrame, then entity and features should be provided.
  • If object is of type str, then it is considered as process id of an existing FeatureProcess and reruns the process. Entity and features are taken from the existing feature process. Hence, entity and features are ignored.
  • If object is of type FeatureGroup, then entity and features are taken from the FeatureGroup. Hence, entity and features are ignored.

Optional Parameters

entity
Specifies the entity for the DataFrame.
  • Ignored when object is of type FeatureGroup or str.
  • If a string or list of strings is provided, then object should have these columns in it.
  • If Entity object is provided, then associated columns in Entity object should be present in the DataFrame.
filters
Specifies filters to be applied on data source while ingesting feature values for FeatureProcess.
features
Specifies list of features to be considered in feature process. Feature ingestion takes place only for these features.
Ignored when object is of type FeatureGroup or str.
as_of
Specifies the time period for which feature values are ingested.
If as_of is specified as either string or datetime.datetime, then the specified value is considered as the starting time period and ending time period 31-DEC-9999 23:59:59.999999+00:00.
description
Specifies description for the feature process.

Example setup

>>> load_example_data('dataframe', ['sales'])
>>> df = DataFrame("sales")

Create a feature store repository 'vfs_v1'.

>>> from teradataml import FeatureStore
>>> fs = FeatureStore(repo='vfs_v1', data_domain='sales')
Repo vfs_v1 does not exist. Run FeatureStore.setup() to create the repo and setup FeatureStore.

Set up the feature store for this repository.

>>> fs.setup()
True

Create an instance of FeatureCatalog.

>>> fc = FeatureCatalog(repo='vfs_v1', data_domain='sales')

Example 1: Upload features from the DataFrame

List the available features.

>>> fc.list_features()
entity_name feature_id name data_type feature_type valid_start valid_end

Upload the features.

>>> fp = fc.upload_features(object=df,
...                         entity=["accounts"],
...                         features=["Feb", "Jan", "Mar", "Apr"])
Process '01c70f05-4067-11f0-9e8a-fb57338c2e68' started.
Process '01c70f05-4067-11f0-9e8a-fb57338c2e68' completed.

Verify the features are uploaded.

>>> fc.list_features()
            feature_id name data_type feature_type                      valid_start                       valid_end
entity_name                                                                                                       
accounts              4  Feb     FLOAT   CONTINUOUS  2025-06-12 05:28:42.916821+00:  9999-12-31 23:59:59.999999+00:
accounts              6  Apr    BIGINT   CONTINUOUS  2025-06-12 05:28:42.916821+00:  9999-12-31 23:59:59.999999+00:
accounts              5  Mar    BIGINT   CONTINUOUS  2025-06-12 05:28:42.916821+00:  9999-12-31 23:59:59.999999+00:
accounts         100002  Jan    BIGINT   CONTINUOUS  2025-06-12 05:28:42.916821+00:  9999-12-31 23:59:59.999999+00:

Example 2: Upload features from the feature group

Create a FeatureGroup object.

>>> fg = FeatureGroup.from_DataFrame(name="sales", entity_columns="accounts", df=df)

Create a FeatureCatalog object.

>>> fc = FeatureCatalog(repo='vfs_v1', data_domain='sales')
>>> fp = fc.upload_features(object=fg)
Process '01c70f05-4067-11f0-9e8a-fb57338c2e68' started.
Process '01c70f05-4067-11f0-9e8a-fb57338c2e68' completed.

Verify the features are uploaded.

>>> fc.list_features()
             feature_id name data_type feature_type                     valid_start                       valid_end
entity_name                                                                                                       
accounts              4  Feb     FLOAT   CONTINUOUS  2025-06-12 05:28:42.916821+00:  9999-12-31 23:59:59.999999+00:
accounts              6  Apr    BIGINT   CONTINUOUS  2025-06-12 05:28:42.916821+00:  9999-12-31 23:59:59.999999+00:
accounts              5  Mar    BIGINT   CONTINUOUS  2025-06-12 05:28:42.916821+00:  9999-12-31 23:59:59.999999+00:
accounts         100002  Jan    BIGINT   CONTINUOUS  2025-06-12 05:28:42.916821+00:  9999-12-31 23:59:59.999999+00:

Example 3: Upload features through process id

Create a FeatureProcess object.

>>> fp = FeatureProcess(repo='vfs_v1',
...                     data_domain='sales',
...                     object=df,
...                     entity='accounts',
...                     features=['Jan', 'Feb', 'Mar', 'Apr'])
>>> fp.run()
Process '01c70f05-4067-11f0-9e8a-fb57338c2e68' started.
Process '01c70f05-4067-11f0-9e8a-fb57338c2e68' completed.

Create a FeatureCatalog object.

>>> fc = FeatureCatalog(repo='vfs_v1', data_domain='sales')
>>> fp = fc.upload_features(object=fp.process_id)
Process '01c70f05-4067-11f0-9e8a-fb57338c2e68' started.
Process '01c70f05-4067-11f0-9e8a-fb57338c2e68' completed.