Snowflake Data Lineage

Data travels. A raw file becomes a staging table, a staging table feeds a model, and a model feeds a dashboard. When someone changes one step, every downstream step feels it. Lineage maps that journey, so teams know what breaks before they change anything and where a wrong number came from.

The Family Tree Comparison

A family tree shows parents above and children below. Pointing to one person reveals ancestors and descendants. Data lineage works the same way for tables and views. Upstream objects feed the object you inspect, and downstream objects depend on it.

LINEAGE GRAPH
=============

 UPSTREAM (sources)              THIS OBJECT          DOWNSTREAM (users)
 +-------------+                +-----------+         +----------------+
 | raw_orders  |---+            |           |    +--->| v_sales_report |
 +-------------+   +----------->| stg_orders|----+    +----------------+
 +-------------+   |            |           |    |    +----------------+
 | raw_items   |---+            +-----------+    +--->| dashboard_feed |
 +-------------+                                      +----------------+

Lineage in Snowsight

Snowsight draws the graph for you. Open a table or view in the catalog and choose the Lineage tab. The graph shows upstream and downstream objects, and column-level views trace a single column through each step. Lineage visibility depends on edition and on privileges: users see only the objects their role can access.

Object Dependencies with SQL

The OBJECT_DEPENDENCIES view lists which objects reference which other objects, such as a view built on a table or a view built on another view.

SELECT referencing_object_name  AS dependent_object,
       referencing_object_domain AS dependent_type,
       referenced_object_name    AS source_object,
       referenced_object_domain  AS source_type
FROM SNOWFLAKE.ACCOUNT_USAGE.OBJECT_DEPENDENCIES
WHERE referenced_object_name = 'STG_ORDERS'
  AND referenced_database    = 'SALES_DB';

The query answers the impact question: what depends on stg_orders? Run it before renaming a column or dropping a table.

Impact Analysis Routine

BEFORE CHANGING A TABLE
=======================
1. Query OBJECT_DEPENDENCIES for everything that references the table
2. Open Lineage in Snowsight to see dashboards and downstream models
3. Ask owners of each dependent object for a review window
4. Clone the database and test the change on the clone
5. Release the change and watch alerts for failures

Building a Full Dependency Chain

A recursive CTE follows dependencies through many levels of views.

WITH RECURSIVE chain AS (
  SELECT referenced_object_name, referencing_object_name, 1 AS depth
  FROM SNOWFLAKE.ACCOUNT_USAGE.OBJECT_DEPENDENCIES
  WHERE referenced_object_name = 'RAW_ORDERS'
  UNION ALL
  SELECT d.referenced_object_name, d.referencing_object_name, c.depth + 1
  FROM SNOWFLAKE.ACCOUNT_USAGE.OBJECT_DEPENDENCIES d
  JOIN chain c ON d.referenced_object_name = c.referencing_object_name
  WHERE c.depth < 10
)
SELECT DISTINCT depth, referencing_object_name FROM chain ORDER BY depth;

The depth limit prevents runaway loops in unusual designs.

Lineage Through Data Movement

Dependencies cover views and similar objects. Tables loaded by tasks, COPY statements, or INSERT queries create links that show up in Access History. The OBJECTS_MODIFIED column lists which objects a query wrote, and BASE_OBJECTS_ACCESSED lists what it read. Joining the two records reveals pipeline links that no view definition shows.

Why Teams Care

  • Safe changes: owners see every consumer of a table before editing it.
  • Faster debugging: a wrong number traces back to its source step by step.
  • Audit proof: regulators ask where reported figures come from.
  • Cleanup confidence: objects with no downstream users become retirement candidates.

Limits to Remember

Lineage covers activity inside Snowflake. Steps that happen in outside tools appear only when those tools run SQL that Snowflake records. Account Usage data arrives with a delay, so very recent changes may not show yet. Document external steps in a data catalog to fill the gaps.

A Practical Scenario

An engineer plans to rename a column in a staging table. The dependency query returns nine views and two dashboards. The engineer messages each owner, updates the nine views in a clone, and tests the dashboards. The rename goes live on a quiet morning with no broken reports.

Frequently Asked Questions

Does lineage show objects I cannot access?

The graph respects privileges, and restricted objects may appear hidden or masked. Ask an administrator with broader rights for a full impact review.

Key Points

  • Lineage maps upstream sources and downstream consumers of any object.
  • Snowsight draws table and column lineage graphs.
  • OBJECT_DEPENDENCIES lists which objects reference which others.
  • Recursive queries follow multi-level dependency chains.
  • Run impact analysis before renaming, altering, or dropping objects.
  • Combine lineage with Access History to trace pipeline writes.