open-metadata / OpenMetadata

OpenMetadata is a unified metadata platform for data discovery, data observability, and data governance powered by a central metadata repository, in-depth column level lineage, and seamless team collaboration.
https://open-metadata.org
Apache License 2.0
5.55k stars 1.05k forks source link

Allow Python SDK's lineage API to accept openmetadata native entities #17896

Closed k-ye closed 1 month ago

k-ye commented 1 month ago

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

I would like to query the lineage relationships in the Python SDK. While the SDK offers the APIs, using them correctly is still not very intuitive. For example:

  1. get_lineage_by_id(Table, entity.id): This doesn't work - the requested URL looks something like v1/lineage/table/root=UUID('abcdef')?upstreamDepth=1&downstreamDepth=1
  2. get_lineage_by_id(Table, entity.id.root): This works, with UUID being encoded correctly in the URL.

The trick is to read the .root field manually from either ID or FQN, since these are pydantic abstractions.

I'd hope that the API implementation could extract .root part automatically.

Describe alternatives you've considered

Keep it as is, make it obvious in the documentation

Additional context

Slack discussion: https://openmetadata.slack.com/archives/C02B6955S4S/p1726299424402459