> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# Logical view OpenLineage

> Export a logical view's declared dataset and column lineage as standard design-time OpenLineage events.

Export an existing the database logical view by name:

```sql theme={null}
EXPLAIN OPENLINEAGE [BRIEF | VERBOSE | FULL] [<db>.]<view>;
```

The root view's definition is always expanded. Default BRIEF includes the root, its direct sources and its definition Job. VERBOSE additionally expands each direct View/MV/SV source once. FULL follows all expandable declarations to physical tables, retaining intermediate datasets and computation Jobs. Physical [OLAP](/documents/4.2/using_starrocks/olap_table_openlineage.md) and [external tables](/documents/4.2/using_starrocks/external_table_openlineage.md) are leaves.

```sql theme={null}
CREATE VIEW sales_v1 AS SELECT id, amount * 3 AS amount FROM orders;
CREATE VIEW sales_v2(order_id, total) AS
SELECT id, amount + 1 FROM sales_v1 WHERE id > 0;
EXPLAIN OPENLINEAGE sales_v2;
EXPLAIN OPENLINEAGE FULL sales_v2;
```

BRIEF stops at `sales_v1`. FULL adds `orders` and the `sales_v1` computation. In this two-view example VERBOSE and FULL have the same graph. For a deeper chain, VERBOSE stops after expanding only one layer of the root's sources.

Each result row is a standard JSON DatasetEvent or JobEvent, without a private wrapper. The root Dataset has type VIEW. `schema` exposes `order_id` and `total`; `lineage.fields` maps them to `sales_v1.id` and `sales_v1.amount`. The indirect FILTER dependency on `sales_v1.id` is retained in `lineage.inputs`, separate from value mappings. Definition Jobs carry SQL and input/output datasets. No Run is emitted: declaring or inspecting a logical view is not an execution or materialization.

The command requires SELECT on the root and each exposed source. It resolves the definition in its owning catalog/database, uses the stored schema/output aliases and creation SQL mode, restores the session catalog/database on success or failure, and never changes catalog metadata. This entry supports the database logical views created with CREATE VIEW, including ones over external tables. Connector-native Hive/Iceberg/Paimon view definitions are not expanded by this exporter; encountering an unavailable definition during expansion fails explicitly.

```bash theme={null}
mysql -h 127.0.0.1 -P 9030 -u root --batch --skip-column-names --raw \
  -e 'EXPLAIN OPENLINEAGE FULL example_db.sales_v2' > sales-view.ndjson
```

See [Semantic View OpenLineage](/documents/4.2/using_starrocks/semantic_view_openlineage.md) for facts, dimensions and metrics.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.