Skip to main content

Lineage Keeper

A lightweight lineage tool based on Spark and Delta Lake

Architecture

Table of contents

Instalation

pip install lineage-keeper

Basic use

from lineage_keeper import load_listener, LineageViewer
load_listener(spark)

df1 = spark.read.table("db.table_1")
df2 = spark.read.table("db.table_2")

df_join = df1.join(df2, "key")

df_join.write.saveAsTable("db.join_tables")

LineageViewer(spark).viewer()

Functionalities

By default Lineage Keeper use "default._service_table_lineage_keeper" as a service table.

If wanted its possible to use a different service table.

Listener function

Manually input lineage information on the service table

LineageListener : spark sesison listener : source DataFrame, target table

ll = LineageListener(spark)
ll.listener(df, "target_db.target_table")

load listener

Change df.write.saveAsTable to automatically input lineage information on the service table

load_listener(spark)

Lineage graph viewer

Generate a static HTML with the lineage graph

LineageViewer(spark).viewer()

Lineage graph writer

Save a static HTML with the lineage graph on disk

LineageViewer(spark).save_graph(path)

Limitations

  • Its necessary to use tables sintax to read data
    • spark.read.table("db.table")
    • spark.sql("SELECT * FROM db.table")
  • To use load_listener to is necessary to use df.write.saveAsTable("db.table") otherwise need to call LineageListener(spark).listener(df, "db.table")

Demo Notebook

Sample using Lineage Keeper

Graph_Sample

Metadata

Release files for lineage-keeper 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lineage-keeper 0.2
File Size Uploaded
lineage_keeper-0.2.tar.gz 4.7 kB Details

Release files / lineage_keeper-0.2.tar.gz

Download URL lineage_keeper-0.2.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2b783fbc7b75eecdb8e98d03042f63ab8b0ac74b2c885b76cdb08ca058df78f6
BLAKE2b-256 checksum
How to use checksums
86b49882a3952899f3f130864f6bb840ab6180af5b4e22e2961dd7d4121e3f4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page