Skip to main content

Personal SQL lineage generator.

Project description

Python Poetry tests coverage GitHub last commit

code style: prettier code style: black Imports: isort pre-commit.ci status Sourcery


SQL Lineage 🔀

Personal SQL lineage generator.

Built on the following awesome libraries:

So... what is this? 🤔

[!NOTE]

This project is still in development and currently only parses the CTEs of an SQL query since that's all I need for now.

I write a lot of SQL, and I often need to understand "lineage" in lots of different ways.

Things like dbt and SQLMesh are great for object lineage (tables, columns, etc.), but I often need to understand "lineage" like the CTE lineage in a query, among other things.

This project is just a personal tool to help me generate lineage diagrams (in Mermaid syntax) for SQL queries to fit that requirement.

Upcoming improvements will (hopefully) include:

  • Column lineage to Mermaid
  • Semantic edges (e.g. distinguish between JOIN, WHERE, UNION, etc.)
  • Lineage for multiple files in a single diagram

Installation ⬇️

Grab a copy from PyPI like usual (note the bills- prefix):

pip install bills-sql-lineage

Usage 📖

Pass the path to a SQL file to the lineage command to generate the lineage as a Mermaid diagram:

lineage path/to/file.sql

This will write a Mermaid diagram to path/to/file.mermaid. You can control the target with the second argument:

lineage path/to/file.sql path/to/output.mermaid

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

bills_sql_lineage-0.0.1.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

bills_sql_lineage-0.0.1-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

Supported by

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