Skip to main content
Use EXPLAIN OPENLINEAGE to export a semantic view’s declared dataset and column dependencies as standard OpenLineage JSON. It includes facts, dimensions, metrics and the computation definitions that connect them to source datasets. This is design-time lineage: the statement does not execute or materialize the computation, create an SV, or modify catalog metadata.

Syntax

The default level is BRIEF. Input is either a saved semantic-view name or a CREATE SEMANTIC VIEW declaration.

Usage

Export a saved semantic view

For an existing example_db.sales_sv:
Named input reads the saved SV DDL automatically. You do not need to retrieve and resubmit it. The exported target follows the current SV identity after rename. Saved declarations are interpreted using their creation SQL mode rather than the inspecting session’s SQL mode.

Analyze a declaration without creating the semantic view

Suppose example_db.orders already has columns id, amount and discount:
This analyzes the definition without registering sales_preview. The database and referenced sources must already exist. A dry-run declaration does not require CREATE_VIEW; SELECT privileges are checked on every exposed source. Named input additionally requires SELECT on the target SV.

Choose the lineage depth

Physical tables are leaves in every mode. Missing sources, insufficient privileges, unsupported expansion or cyclic dependencies are errors, not permission to guess a partial physical pipeline. Depth controls expansion, not SQL execution or materialization.

Interpret the output

Each SQL result row is one standard OpenLineage JSON event, not a private wrapper:
  • A table, View, MV or SV is a Dataset. DatasetEvents carry schema and lineage metadata.
  • An expanded computation declaration is a Job with a JobEvent containing declared inputs/outputs and SQL.
  • No Run or RunEvent is emitted: analyzing a declaration is not an execution instance.
  • Facts, dimensions and metrics appear in schema.fields, with their semantic role in standard field tags (semantic_role) and their expression in the field description.
  • lineage.fields records direct column dependencies; lineage.inputs also records dataset-wide controls such as FILTER and JOIN. Job SQL preserves the declaration’s computation.
  • A constant or COUNT(*) can have no direct input column while still depending on source datasets. An empty field-input list does not mean there is no lineage.
The export uses standard OpenLineage events/facets. A consumer must support the emitted event/facet types to build its own graph; standard compliance does not guarantee every historical consumer’s native UI supports design-time column lineage. See the OpenLineage object model and lineage facet.

Save the JSON

Adjust the connection options for your cluster. The MySQL client’s raw batch output preserves one JSON event per line (NDJSON).

Example: a semantic view over logical views

This case uses sv_recommendation/tpcds_test/query06. The linked JSON files are actual exports archived on October 23, 2026, not hand-written examples or a fresh run of the latest implementation. Empty physical tables were sufficient for metadata/lineage verification; these files do not prove populated-data query equivalence.

Definitions

The five physical tables are store_sales, customer, customer_address, date_dim, and item. Two logical views filter the date and item inputs. The SV declares 12 dimensions, one metric, and no facts. Full source files, including the original empty semantic-metadata placeholders: The view computations are:
The SV definition below omits only empty synonyms, comments, sample values, and AI instruction placeholders. The linked original DDL retains them.
See CREATE SEMANTIC VIEW for the declaration syntax and the meaning of relationships. This is a graph of declared dependencies, not a claim that every query must execute every declared join.

JSON output

Each SQL result row is one standard JSON event. The downloadable .ndjson files preserve these rows verbatim, without a private wrapper. In the archived test, the database qualifier was changed from tpcds_1g to isolated database ol_corpus_3be7062938_tpcds; the namespace is starrocks://582847750/default_catalog. Business expressions are unchanged. The metadata-only fixture also reduced physical bucket counts and replication; these storage settings do not affect the lineage shown here. VERBOSE and FULL are identical after removing only eventTime in this case: both views directly depend on physical tables. FULL preserves intermediate views rather than flattening away their definitions. The SV’s standard schema has 13 fields. Standard field tags identify DIMENSION or METRIC through semantic_role; no custom facet is needed. For example, this is an extracted fragment of dataset.facets.lineage.fields, not a complete standalone event:
In VERBOSE/FULL, the view’s own event adds item.i_category → v_i_06_1.i_category, completing the two-edge physical-to-semantic path. Its standard Job SQL facet retains the correlated average-price filter. The standard legacy columnLineage facet is also present for consumers that support it. COUNT(*) reads a row set, not the value of an individual column. Its empty direct field inputs are intentional; its expression is retained in the schema description and Job SQL. Dataset inputs and indirect controls describe the surrounding dependencies. Do not fabricate a physical-column-to-count edge.

Dataset and column lineage

Rectangular nodes in dataset graphs are Datasets; rounded nodes are definition Jobs, not execution Runs. Column graphs show every exported field dependency: solid blue edges are direct identity mappings; dashed edges terminate at dataset-wide FILTER/JOIN controls, not at invented per-field dependencies. Database qualifiers are omitted from image labels only; the raw JSON is unchanged. The column graphs contain all 13 SV fields. VERBOSE/FULL additionally show all four date-view fields and six item-view fields, including view output columns not selected as SV dimensions.

BRIEF

BRIEF dataset and Job lineage for query06 BRIEF complete column lineage for query06 BRIEF has 12 direct field edges and eight dataset-wide JOIN control inputs. It stops at v_d_06_1 and v_i_06_1 and therefore does not export their underlying filters.

VERBOSE

VERBOSE dataset and Job lineage for query06 VERBOSE complete column lineage for query06 VERBOSE adds two physical tables, two definition Jobs, ten direct field edges, and five FILTER control inputs. The total is 22 direct field edges and 13 dataset-wide control inputs.

FULL

FULL dataset and Job lineage for query06 FULL complete column lineage for query06 The FULL graph has the same topology and dependencies as VERBOSE for this example. It is shown separately so that each requested export has its own dataset and column image.

Indirect controls

The date view records FILTER dependencies on date_dim.d_year, d_moy, and d_month_seq. The item view records FILTER dependencies on item.i_category and i_current_price, including the correlated category comparison and the average-price expression in Job SQL. These controls influence row selection, not the direct value identity mappings. The SV records eight JOIN endpoint dependencies for these four declared relationships: These controls live in lineage.inputs; direct value mappings live in lineage.fields. A consumer must consider both, together with Job SQL, to interpret the declared computation.

Check exported references

For exports of the same unchanged SV, the following inline Python example checks that dataset/column references resolve, including dataset-wide controls. It is a lightweight referential check, not a replacement for the official OpenLineage JSON Schemas. No repository-specific test utility is required.
All three languages reference the same PNG, SQL and NDJSON files in docs/_assets/semantic-view-openlineage-query06. The @site resource alias resolves them through the Docusaurus site directory even when language trees are relocated. There are no localized copies, DOT sources or separate rendering/test scripts.