Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions clients/python/marquez_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,32 @@ def get_job_run(self, run_id):
Utils.is_valid_uuid(run_id, 'run_id')
return self._get(self._url('/jobs/runs/{0}', run_id))

def get_lineage(self, node_id, depth=None):
"""Fetch the lineage graph for a given node.

Returns the lineage graph (upstream and downstream datasets and jobs)
for the specified node ID. The node ID format is:
- For datasets: "dataset:<namespace>:<name>"
- For jobs: "job:<namespace>:<name>"

Args:
node_id: The node identifier to fetch lineage for.
depth: The maximum depth of the lineage graph (default: 20).

Returns:
A dict representing the lineage graph with nodes and edges.
"""
if not node_id:
raise ValueError('node_id must not be None')

return self._get(
self._url('/lineage'),
params={
'nodeId': node_id,
'depth': depth or DEFAULT_DEPTH
}
)

def get_column_lineage_by_dataset(
self,
namespace,
Expand Down