Sub topic 16
Discovering features and tracing lineage
This chapter assumes you can create and write feature tables, build training sets, and log models with fe.log_model. It also assumes you know Unity Catalog's catalog.schema.table naming. Here you will learn how to make feature tables easy to find and how to see what depends on them.
Why discovery matters
A feature table that nobody can find gets rebuilt by another team under a different name. Each copy computes the feature slightly differently, which brings back the training-serving skew that feature tables are meant to reduce. Discovery lets teams reuse features. Lineage tells you what breaks if you change one.
Making feature tables discoverable
A feature table is a Unity Catalog table, so the metadata tools for tables apply to it. Catalog Explorer lets you browse catalogs and schemas, search by name, and open a table to see its columns, primary key, owner, and sample data. The Databricks UI also has a Features page for browsing feature tables.
Search only helps if the metadata is filled in. Add a table description, column comments, and tags:
COMMENT ON TABLE main.ml.user_features IS
'Per-user order features over the last 90 days. Refreshed daily.';
ALTER TABLE main.ml.user_features
ALTER COLUMN order_count_90d COMMENT 'Orders placed in the last 90 days';
ALTER TABLE main.ml.user_features
SET TAGS ('domain' = 'churn', 'owner_team' = 'growth');You see only the objects you have privileges on, so discovery respects governance. To let a team find a feature table, grant them access to it, or at least the ability to browse it.
Tracing lineage
Unity Catalog records lineage automatically for queries and jobs that run on Unity Catalog compute. For feature work, three links matter:
- Upstream: the raw tables, such as
main.sales.orders, that fed a feature table. - Downstream: the notebooks, jobs, and models that read the feature table.
- Model to features: a model logged with
fe.log_modelrecords which feature tables it uses, so you can see the dependency from either side.
The Lineage tab in Catalog Explorer shows these links as a graph.
You can also query lineage with SQL if system tables are enabled in your account:
SELECT source_table_full_name,
target_table_full_name,
entity_type,
event_time
FROM system.access.table_lineage
WHERE source_table_full_name = 'main.ml.user_features'
ORDER BY event_time DESC
LIMIT 20;Run this before changing a feature's definition. The result lists the consumers you need to notify or retrain.
Common errors
- Empty lineage graph. Lineage is captured only for supported compute and only for runs after capture began. Re-run the job and check again.
- Missing tables in search. You lack privileges, or the table has no useful name or description.
- Querying system tables fails. An account admin must enable the system schema, and you need
SELECTon it.
Exercise
You plan to change how avg_order_amount_90d is computed in main.ml.user_features. Which two things should you do first to find what the change could affect?
Show answer
Check the table's downstream lineage in Catalog Explorer, or query system.access.table_lineage with the table as the source. That finds the jobs and models that read it. Then notify those owners or retrain their models, because they were trained on the old definition.