Repository navigation
Lineage
Lineage says what a table or column is built from and what reads it, taken from dbt manifests, view definitions and human overlays. It is declared or parsed, never measured and never verified, and it is never a join path. Parsing SQL needs the optional
lineageextra; only a hash and a literal-free template of a view's SQL are ever stored.
analytics.revenue_daily is a view over shop.orders and shop.refunds. That fact is lineage.
SchemaGuru stores it as a LINEAGE fact on the view (table level) and, per column, as
COLUMN_LINEAGE facts (for example net_revenue comes from orders.amount and
refunds.amount, transform: aggregate). Both kinds are always UNVERIFIED: they state what a
tool or a person declared, or what a SQL text says, not what the data does, and nothing in
SchemaGuru promotes them.
Lineage is not a join path. Two tables built from the same source are not thereby joinable;
find_join_path never reads lineage, and a lineage answer never names a join key. See
Join-Graph for how joins are measured.
| Source | Provenance | Notes |
|---|---|---|
| dbt manifest | DECLARED |
depends_on gives tables; compiled_code gives columns (run dbt compile, else SG214) |
| View definitions | CATALOG |
the crawl reads each view's SQL from the engine's metadata views (Catalog-and-Crawl) |
| Overlays | HUMAN |
a lineage: list; a human entry replaces parsed links, ignore: true hides them (Overlays) |
Every shipped reader implements view_definitions (PostgreSQL and Redshift pg_views, DuckDB
duckdb_views(), Snowflake, BigQuery, Databricks, MySQL and Trino information_schema, ClickHouse
system.tables.as_select, SQL Server sys.sql_modules, Oracle ALL_VIEWS and ALL_MVIEWS).
A custom reader without it is never asked.
pip install 'schemaguru[lineage]' installs sqlglot. Without it the crawl does not read view
definitions at all (SG212, once per crawl or import), dbt import yields table lineage only, and
overlay lineage still works. So view lineage of any level, and every column link parsed from SQL,
needs the extra.
SQL is parsed in a separate worker process, started once per crawl or import. Each parser request
has a hard 5 s cap: on a timeout the worker is killed and replaced, and that definition gets
SG211 timeout and no lineage. A definition takes two requests (tables, then lineage). A
definition over 1,000,000 characters is skipped before parsing. On Linux the worker also has a
1 GiB memory cap. A failure of any kind is a diagnostic for that definition; the crawl goes on.
The raw definition text lives in memory only while it is parsed. The store keeps the lineage
facts, a sha256 of the definition plus the relation names it reads (so an unchanged view whose
names still resolve the same way is not parsed again) and a template of it
with every literal replaced by a placeholder ("..." too, in dialects where it can be a string:
BigQuery, Databricks/Spark, Hive, MySQL/MariaDB, T-SQL, unknown). Nothing raw is persisted, logged, rendered, put in a
diagnostic or sent to an LLM. See PII-and-Sampling-Policy and Security.
-
agentview:Built from: <ref>, <ref> (+N more) · <source> · unverifiedunder the description, and← <input> (<transform>)after a column (at most 3 inputs, then+N more; an input the store does not hold reads(not in catalog)). -
plannerview: the table line only.verifierview: keyed lines, one per distinct link:LINEAGE <table> <- <ref>[, <ref>…]andCOLUMN_LINEAGE <table>.<column> <- <ref>… <transform>, an unresolved ref writtenname(unresolved). See Rendering. - The
lineagetool:ref,direction(upstreamordownstream),depth1 to 5 (default 2),level(tableorcolumn). The result hastext,nodes,edges,truncated(200-node cap) andcycles. It works from Python (guru.lineage(...)returns aLineageResult; useguru.handle_tool_call("lineage", {...})["text"]for text), the CLI (schemaguru lineage REF),GET /lineage(Server) and MCP (Agent-Integration).
- Never a join path; never verified.
-
SELECT *and unqualified columns are expanded from the columns the store holds; a name it does not hold is listed as unresolved, never guessed. - Projection lineage only: a column used only in
WHERE,JOIN ONorGROUP BYis not an input. - An unaliased computed output (a bare
SUM(x)) gets no column lineage. - A parser worker outlives a hard-killed parent only until its current parse returns (at most the
5 s cap). A deleted
JOINedge can stay in the cached graph until the snapshot, generation or date changes. - A custom store without the lineage index answers downstream queries with
SG705(Extending-Store). - The worker is started as
sys.executable -m schemaguru.lineage.worker: under an embedded or frozen interpreter, or with asys.pathextended only at runtime, every view fails closed withSG211 worker_died. - If the reader's
view_definitionscall fails (SG102), that batch's views keep their last parsed lineage; a view answered without a definition loses it (SG211 definition_unavailable).
Diagnostics: SG211 (a definition could not be parsed), SG212 (extra missing), SG213 (an
ignore matches nothing), SG214 (no compiled_code), SG215 (dbt nodes disagree), SG705
(Diagnostics). At 500,000 tables the lineage parse is part of the measured crawl (Scale).
-
Overlays - the
lineage:entries and ignore semantics - Catalog-and-Crawl - how view definitions are read
- Rendering - the lineage lines in each profile
- Scale - lineage at 500,000 tables
SchemaGuru is open source under the MIT License, Copyright (c) 2026 Rupak Chakraborty · Repository · Issues · This wiki is generated from docs/wiki/; edit it there, not here.
Start here
Components
- Catalog and Crawl
- Store
- Measurement
- Sampling
- Join Graph
- Path Search and Hub Guard
- Waypoint Rules
- Drafting
- PII and Sampling Policy
- Overlays
- Lineage
- Scoping
- Rendering
- Refresh and Drift
- Feedback and Guard
- Server
- Agent Integration
Using it
Warehouses
- BigQuery
- Snowflake
- Redshift
- Databricks
- PostgreSQL
- DuckDB
- ClickHouse
- SQL Server / Synapse
- Oracle
- Trino
- MySQL / MariaDB
Extending
- CatalogReader
- Store
- Retriever and Embedder
- TokenCounter
- LLMProvider
- PII Detector
- FailureClassifier
- FactKind
- Profile and Format
- ChangeClassifier
- JoinCandidateSource (planned)
- Authenticator
Project