marquez icon indicating copy to clipboard operation
marquez copied to clipboard

feat: add get_lineage() to Python client

Open psaikaushik opened this issue 7 months ago • 2 comments

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

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

psaikaushik avatar Apr 15 '26 05:04 psaikaushik

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

psaikaushik avatar Apr 15 '26 05:04 psaikaushik

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: 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           

:umbrella: View full report in Codecov by Harness.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Apr 15 '26 05:04 codecov[bot]