Skip to main content

REFRESH LINEAGE

Introduced or updated: v1.2.935
note

Data Lineage is an Enterprise Edition feature. Self-hosted deployments require an enterprise or trial license; Databend Cloud includes this feature.

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
);
note

To change a logical view definition, use CREATE OR REPLACE VIEW. ALTER VIEW ... AS ... is not supported because changing the definition without recreating the view could leave persisted lineage inconsistent.

Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today