Skip to main content

A beautiful SQL lineage tracker that parses SQL files, extracts table & column-level lineage, and visualizes data flow with an interactive graph.

Project description

๐Ÿ”— SQL Lineage Tracker

Parse SQL files. Extract data lineage. Visualize the flow.

A beautiful, open-source Python tool that parses SQL files, extracts table & column-level lineage across multiple files, and renders an interactive graph in your browser.


โœจ Features

  • 20+ SQL Dialects โ€” PostgreSQL, MySQL, BigQuery, Snowflake, Spark, and more (powered by sqlglot)
  • Complex SQL Support โ€” CTEs, subqueries, JOINs, UNIONs, MERGE, window functions
  • Multi-File Resolution โ€” Upload interdependent SQL files and see cross-file lineage
  • Table & Column Lineage โ€” Track dependencies at both table and column level
  • Column Transformations โ€” See exactly how each column is derived (e.g., SUM(amount), LOWER(TRIM(email)))
  • Interactive Graph โ€” Hierarchical DAG layout with zoom, pan, search, and click-to-highlight
  • Upstream/Downstream Tracing โ€” Click any node to trace its full lineage path
  • Export โ€” Download lineage as PNG image or JSON data
  • CLI & Web UI โ€” Use from the terminal or launch a gorgeous dark-mode web interface
  • Execution Order โ€” Automatic topological sort of table dependencies

๐Ÿš€ Quick Start

Install from PyPI

pip install sqllineage-tracker

Install from Source

git clone https://github.com/saman/sql-lineage-tracker.git
cd sql-lineage-tracker
pip install -e .

Launch the Web UI

sqllineage serve

Then open http://localhost:8000 in your browser, upload your SQL files, and click Analyze Lineage.

CLI Usage

# Analyze SQL files
sqllineage analyze examples/ecommerce/*.sql

# JSON output
sqllineage analyze examples/ecommerce/*.sql --format json

# With column-level lineage
sqllineage analyze examples/ecommerce/*.sql --columns

# Specify dialect
sqllineage analyze my_query.sql --dialect bigquery

# List supported dialects
sqllineage dialects

Use as a Library

from sqllineage import resolve_files

graph = resolve_files(["file1.sql", "file2.sql"], dialect="postgres")

# Get D3.js-compatible JSON
data = graph.to_d3_json()

# Explore lineage
print(graph.get_upstream("mart.user_summary"))
print(graph.get_downstream("raw.users"))

๐Ÿ—๏ธ Project Structure

sql-lineage-tracker/
โ”œโ”€โ”€ sqllineage/
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ models.py        # Table, Column, LineageEdge, LineageGraph
โ”‚   โ”‚   โ”œโ”€โ”€ parser.py        # sqlglot wrapper (20+ dialects)
โ”‚   โ”‚   โ”œโ”€โ”€ extractor.py     # AST โ†’ lineage edges
โ”‚   โ”‚   โ””โ”€โ”€ resolver.py      # Multi-file resolution + topo sort
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ””โ”€โ”€ server.py        # FastAPI backend
โ”‚   โ”œโ”€โ”€ web/
โ”‚   โ”‚   โ”œโ”€โ”€ index.html        # Web UI
โ”‚   โ”‚   โ”œโ”€โ”€ styles.css        # Dark mode + glassmorphism
โ”‚   โ”‚   โ””โ”€โ”€ app.js            # D3.js hierarchical DAG
โ”‚   โ””โ”€โ”€ cli.py                # CLI entry point
โ”œโ”€โ”€ tests/                     # pytest test suite
โ”œโ”€โ”€ examples/                  # Sample SQL pipelines
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ LICENSE                    # MIT

๐Ÿงช Development

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

# Build the package
python -m build

# Check the package
twine check dist/*

๐Ÿ“œ License

MIT โ€” see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqllineage_tracker-0.1.0.tar.gz (39.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqllineage_tracker-0.1.0-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

Details for the file sqllineage_tracker-0.1.0.tar.gz.

File metadata

  • Download URL: sqllineage_tracker-0.1.0.tar.gz
  • Upload date:
  • Size: 39.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for sqllineage_tracker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4a32e169091260d8f4961280630b57df162f278cc1623b81d18be23c9148ae70
MD5 2cf61240377e02e97e3b62b1615d4f0e
BLAKE2b-256 c523ec6d4713df216280fe8f87d481957ef0acae0598be21d906885be16e5536

See more details on using hashes here.

File details

Details for the file sqllineage_tracker-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sqllineage_tracker-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eceb7ab7be0efaf13bc64f0304a65b8c15a8818050ed025a1aeead71451f5d62
MD5 78ee83841f07e35e775be57875140a25
BLAKE2b-256 9f1968573b23ab95e07aa5f3a6937686ebfe6724e799ddfe81cfc56d8d967a02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page