Java SDK for Lineage
The Java SDK provides a fluent API for managing data lineage in Collate. You can query lineage graphs, create edges between entities with column-level mapping, delete edges, export lineage, and run impact analysis.
The fluent entry point is the Lineage class in org.openmetadata.sdk.api.
Lineage in Collate is a relationship between any two entities. While the examples below use tables and dashboards,
the same API works with any entity type (pipelines, topics, ML models, etc.).
Setup
Before using the fluent API, initialize the client:
Querying Lineage
Retrieve the lineage graph for an entity by type and ID:
Custom Depth
Control how many hops upstream and downstream are returned:
Or set both directions to the same value:
Include Deleted Entities
Adding Lineage
Use Lineage.connect() to create an edge between two entities:
Column-Level Lineage
Map specific columns from the source entity to columns in the target entity:
Each target column in toColumns will be mapped to all columns in fromColumns. The resulting payload includes
a columnsLineage array inside lineageDetails.
Pipeline Reference
Associate a pipeline entity that powers the transformation:
SQL Query
Attach the SQL query driving the lineage:
Full Example
Combine all options:
Deleting Lineage
Remove a lineage edge between two entities:
Exporting Lineage
Export the lineage graph for a given entity by its fully qualified name:
Impact Analysis
Analyze which downstream (or upstream) entities are affected by changes to a given entity:
Downstream Impact
Upstream Impact
OpenLineage Events
The SDK also supports posting OpenLineage standard events from tools like Spark or Airflow
via the OpenLineage fluent API:
Batch Events
Static API
For simpler use cases, the LineageAPI class in org.openmetadata.sdk.api provides static methods
that wrap the underlying HTTP calls:
Async Variants
All static methods have CompletableFuture-based async variants: