📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

REFRESH LINEAGE



Backfills or reconciles lineage for existing views in the default catalog. Use this command after enabling data lineage on a deployment that already contains views. Views created after lineage is enabled are tracked automatically.

This command requires the global SUPER privilege and lineage must be enabled. See Data Lineage.

Syntax

REFRESH LINEAGE FOR ALL VIEWS [ DRY RUN ]

DRY RUN calculates and reports the changes without writing them. Run it first to review the work that a refresh would perform.

Output Columns

ColumnDescription
object_domainObject domain; currently VIEW.
catalogCatalog containing the view; currently default.
databaseDatabase containing the view.
object_nameView name.
statusDRY_RUN, REFRESHED, or ERROR.
edge_countNumber of lineage edges found in the current view definition.
upsert_countNumber of missing or changed edges to add or update.
delete_countNumber of stale edges to remove.
errorError details when status is ERROR; otherwise NULL.

Successful views with no changes are omitted from the result.

Examples

Preview the changes required for existing views:

REFRESH LINEAGE FOR ALL VIEWS DRY RUN;

Apply the changes:

REFRESH LINEAGE FOR ALL VIEWS;

After the command completes, query a view's upstream lineage with GET_LINEAGE:

SELECT distance, source_object_database, source_object_name, target_object_database, target_object_name FROM GET_LINEAGE( 'lineage_demo.sales_view', 'VIEW', 'UPSTREAM', 1 );

Was this page helpful?