Good practices¶
Rules that keep a feature pipeline refreshable, explainable and cheap to run. Each rule states why it holds. The pages linked from a rule give the detail.
The rules¶
| # | Rule | Why | Detail |
|---|---|---|---|
| 1 | A process is a view. Refresh it only through run() / roll_out(). No loop around them, no custom step between dates, nothing written to FS_T_*. Their own internal loops (over dates, over FilterManager segments) are fine. |
A refresh replays the registered view, managers and options. It cannot reproduce what happened outside them, and it raises no error when it does not. | Stay inside the framework |
| 2 | One clock (TimeManager) per data domain. Declare it with set_domain_time_manager. |
Every run then has a business date, and several processes share one valid time. Real time is only the fallback. | One clock per data domain, Domain clock |
| 3 | entity_id is the list of grain columns, and no key column is determined by the others. |
A column the others determine, or one that changes over time, makes a new entity at each change and stops a lookup by the real key from using the primary index. The entity scan of the sanity check finds it from the data. | Entity keys |
| 4 | One process per entity and theme. Readers consume datasets, not storage tables. Give processes of one entity that would share a storage table a storage_tag. |
A MERGE locks its target FS_T_* table, so processes writing the same table run one after the other. A dataset is a view over the tables and follows them. |
Relocating features, Parallel execution plan |
| 5 | Read a manager with a scalar subquery, cast to the type of the source's partitioning column. Segment a FilterManager on the source's partitioning columns. | The scalar is resolved before the scan, so partitions are eliminated. A raw TIMESTAMP WITH TIME ZONE against a TIMESTAMP(0) partitioning column reads all rows (measured). A join to a manager view multiplies rows when the manager holds two. |
FilterManager, Storage and pruning |
| 6 | Build a history forward only, from the first date. Rebuild with roll_out(..., time_id_start=1, force_compute=True). |
Each run writes from its valid time onward. Running an earlier date later rewrites everything after it. | roll_out |
| 7 | Validate with upload_features first, operationalise after. |
upload_features registers and runs once. Re-registering is cheap while you check values, the follow-up row and the sanity check. |
From prototype to production |
| 8 | Let the LLM write the documentation and let a person correct it. | A correction is stored as MANUAL and is not overwritten by an LLM run. Without a model, documentation is fully manual. |
Manual documentation |
| 9 | Plan every removal with plan_removal. |
It lists the dependents (datasets, processes, attached views) and refuses to leave a dataset reading a feature that is gone. Editing the catalog or dropping tables by hand does neither. | Inspect & monitor |
| 10 | Check health on a schedule with sanity_check. |
It finds a process that can no longer be refreshed, a failed segment, or a wrong date order before a consumer does. | Sanity checks, Workflow health |
| 11 | Name views and features for the business. | The names are what the dictionary, the agent and the datasets show. | Maintain a workflow |
The first rule in practice¶
import tdfs4ds
# Right: the framework walks the dates and the segments.
tdfs4ds.roll_out(data_domain='SALES')
tdfs4ds.run(data_domain='SALES')
# Right: a process option closes the entities the view no longer returns.
tdfs4ds.set_process_options('<process id>', close_absent_entities=True)
Do not
Set FEATURE_STORE_TIME yourself and call run once per date, call roll_out one date at
a time with your own step between, or DELETE / UPDATE rows of FS_T_*. The sanity checks
usage and closed_entities report a process used this way as at risk or
not refreshable.
A scheduler that calls run once per day is fine. See Operate.