Skip to content

← Training overview

1. First feature

Goal: take a Teradata SQL query and turn it into a registered feature you can re-run, version, and share. Five steps.

The shape of the workflow

  1. Connect to Vantage with tdfs4ds.connect(...). The first call also creates the catalog tables if they don't exist yet.
  2. Pick a DATA_DOMAIN with create_data_domain('MY_PROJECT') (or select_data_domain if it already exists). Every feature, process, and dataset is tagged with this domain, which keeps unrelated projects from colliding in the same physical schema.
  3. Write a Teradata DataFrame that selects your entity keys plus one or more feature columns from a source table.
  4. Call upload_features with the entity ID definition and the list of feature column names. tdfs4ds registers the engineering view as a process, stores its metadata in the catalogs, runs the process for the first time, and merges the results into the feature tables.
  5. Re-run later with run(process_id) — no need to keep the original Python around. The view is now first-class.
import tdfs4ds, teradataml as tdml

tdfs4ds.connect(host='vantage.example.com', user='alice', password='...')
tdfs4ds.create_data_domain('CUSTOMER_360')

df = tdml.DataFrame.from_query("""
    SELECT customer_id,
           DATE '2024-01-01' AS feature_date,
           SUM(amount) AS lifetime_amount
    FROM SALES.ORDERS
    GROUP BY 1, 2
""")

process_id = tdfs4ds.upload_features(
    df=df,
    entity_id=['customer_id'],
    feature_names=['lifetime_amount'],
)

Why DATA_DOMAIN matters

A single Teradata database can host the feature stores of several teams or several modelling exercises. DATA_DOMAIN is the namespace that keeps their catalogs cleanly separated. Always set it before any registration call — otherwise features land in the previous domain and become hard to find later.

Learn more