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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a32e169091260d8f4961280630b57df162f278cc1623b81d18be23c9148ae70
|
|
| MD5 |
2cf61240377e02e97e3b62b1615d4f0e
|
|
| BLAKE2b-256 |
c523ec6d4713df216280fe8f87d481957ef0acae0598be21d906885be16e5536
|
File details
Details for the file sqllineage_tracker-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sqllineage_tracker-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eceb7ab7be0efaf13bc64f0304a65b8c15a8818050ed025a1aeead71451f5d62
|
|
| MD5 |
78ee83841f07e35e775be57875140a25
|
|
| BLAKE2b-256 |
9f1968573b23ab95e07aa5f3a6937686ebfe6724e799ddfe81cfc56d8d967a02
|