skillfed

sqllineage

SQL Lineage Analysis Tool powered by Python

sqllineage v1.5.8 1.7M downloads/30d#3,611 on PyPI1,675
Permissive license MIT Active released

What it is and what it does

SQLLineage is a Python tool that analyzes SQL statements to extract data lineage—the flow of data from source tables through transformations to target tables. It abstracts away the complexity of SQL parsing by using pluggable parsers (sqlfluff and sqlparse) and stores lineage information in a graph structure using networkx. The tool works at both table and column levels, identifying which tables are read and written, and tracking individual column transformations across joins, aggregations, and CTEs.

You can use it as a command-line tool to analyze SQL files or inline queries, or import it as a library in Python code. It supports dialect-aware parsing, can optionally integrate with live database metadata via sqlalchemy to resolve wildcards and ambiguous column references, and includes graph visualization of lineage as a DAG. It handles multiple SQL statements in sequence, identifying intermediate tables that serve as both targets and sources.

Use it for:

  • Audit data pipelines by tracing which source tables feed into a target table through multiple transformation steps.
  • Generate data governance documentation showing column-level lineage for compliance and impact analysis.
  • Detect unused intermediate tables or orphaned source tables in a multi-statement ETL script.
  • Visualize DAG of table dependencies to understand data flow in complex SQL workflows.
  • Resolve column ambiguities in JOIN-heavy queries by connecting to live database metadata.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

SQLLineage parses SQL statements to extract and visualize data lineage—identifying source tables, target tables, and intermediate tables involved in data transformations.

Yes. SQLLineage is actively maintained, has no known vulnerabilities, installs with low friction, and solves a real problem in data governance and pipeline auditing. The MIT license imposes no restrictions. It is suitable for production use in both open-source and commercial contexts.

Install

sqllineage on PyPI

pip

pip install sqllineage

uv

uv add sqllineage

poetry

poetry add sqllineage

Installing sqllineage

Before you install

Low friction installation with a pure-Python wheel. The package is actively maintained with a recent release and depends on well-established libraries (sqlparse, sqlfluff, networkx, rustworkx, sqlalchemy). Supports modern Python versions and has been in production use since 2019.

License in practice

MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects, with only attribution required.

Quickstart

pip install sqllineage

from sqllineage.runner import LineageRunner

runner = LineageRunner("INSERT INTO db1.table1 SELECT * FROM db2.table2")
print(runner.source_tables)
print(runner.target_tables)

Requires Python 3.10 or later.

Verify before relying

  • Performance characteristics with very large SQL files or complex multi-statement queries.
  • Completeness of dialect support beyond the documented examples.
  • Whether metadata-awareness via sqlalchemy connection strings is production-tested across all supported databases.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 5 — networkx, rustworkx, sqlalchemy, sqlfluff, sqlparse
Maintenance actively maintained — 90 days since the last release
Last repo commit
First released
Downloads 1,725,919/month — #3,611 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: sqllineage-1.5.8-py3-none-any.whl

Keywords: data-discovery, data-governance, data-lineage, lineage, metadata, sql

Development Status :: 5 - Production/StableOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPython

Tags

sql lineage analysisdata lineage extractionsql dependency trackingtable-level lineagecolumn-level lineagesql parser lineagedata flow visualization
data-lineagesql-analysisdata-governance

More Database packages