Skip to content

feat: add get_lineage() to Python client#3104

Open
psaikaushik wants to merge 1 commit intoMarquezProject:mainfrom
psaikaushik:feat/1798-add-get-lineage-python-client-v2
Open

feat: add get_lineage() to Python client#3104
psaikaushik wants to merge 1 commit intoMarquezProject:mainfrom
psaikaushik:feat/1798-add-get-lineage-python-client-v2

Conversation

@psaikaushik
Copy link
Copy Markdown

Summary

Adds the missing get_lineage(node_id, depth) method to the Python client, allowing users to fetch the lineage graph for any node directly from Python without resorting to raw curl calls.

Closes #1798 (Python client portion)

What Changed

Added MarquezClient.get_lineage() that calls GET /api/v1/lineage?nodeId=&depth=.

The method follows the same patterns as existing client methods:

  • Input validation (node_id must not be None)
  • Uses DEFAULT_DEPTH (20) when depth is not specified
  • Returns the parsed JSON response

Usage

from marquez_client import MarquezClient

client = MarquezClient(url='http://localhost:8080')

# Get lineage for a dataset
lineage = client.get_lineage('dataset:my_namespace:my_dataset')

# Get lineage for a job with custom depth
lineage = client.get_lineage('job:my_namespace:my_job', depth=5)

Note

This PR covers the Python client. The Java client portion of #1798 will be a separate PR.

Checklist

  • Follows existing client patterns
  • Includes docstring with node_id format examples
  • Input validation for required parameters
  • DCO sign-off included

Add MarquezClient.get_lineage(node_id, depth) method that fetches
the lineage graph for a given node via GET /api/v1/lineage.

The node_id format follows the existing convention:
  - For datasets: "dataset:<namespace>:<name>"
  - For jobs: "job:<namespace>:<name>"

This was the last missing piece: users could already fetch column
lineage but not the standard lineage graph from the Python client.

Closes MarquezProject#1798

Signed-off-by: Sai Kaushik Ponnekanti <psaikaushik@gmail.com>
@psaikaushik
Copy link
Copy Markdown
Author

@wslulciuc , @davidjgoss : Can you please take a look and let me know. thanks!

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.18%. Comparing base (180f37b) to head (2a159bf).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #3104   +/-   ##
=========================================
  Coverage     81.18%   81.18%           
  Complexity     1506     1506           
=========================================
  Files           268      268           
  Lines          7356     7356           
  Branches        325      325           
=========================================
  Hits           5972     5972           
  Misses         1226     1226           
  Partials        158      158           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add MarquezClient.getLineage() to java and py clients

1 participant