View a markdown version of this page

Publishing data lineage programmatically - AWS Glue

Publishing data lineage programmatically

Use the AWS Glue lineage APIs to send lineage from your own code and to read the lineage graph.

  • PostLineageEvent sends an OpenLineage event to AWS Glue Data Catalog.

  • GetLineageNode returns one node of the lineage graph, with the nodes directly upstream and downstream of it.

Publishing lineage with PostLineageEvent

PostLineageEvent accepts OpenLineage run events and dataset events. AWS Glue validates the event, returns an empty response, and then adds the event to the lineage graph asynchronously. A successful response means that AWS Glue accepted the event. It doesn't mean that the graph is already updated.

To call PostLineageEvent, a principal needs the glue:PostLineageEvent IAM permission.

Request

Parameter Required Description
Event Yes The OpenLineage event as a JSON string, up to 300,000 bytes.

Response

The operation returns no data.

Errors

Error Cause
InvalidInputException The event isn't valid OpenLineage JSON, is missing required fields, has an unsupported eventType, or is larger than 300,000 bytes.
AccessDeniedException The caller doesn't have the glue:PostLineageEvent permission.
ThrottlingException The request rate exceeds the quota. Retry with exponential backoff.
InternalServiceException A server error. Retry with exponential backoff.

Example run event

{ "eventType": "COMPLETE", "eventTime": "2026-11-01T18:00:00Z", "producer": "https://example.com/my-pipeline/v1", "schemaURL": "https://openlineage.io/spec/2-0-2/OpenLineage.json#/definitions/RunEvent", "run": { "runId": "0b5c2a4e-6e1f-4b7a-9d2c-1f3e5a7b9c11" }, "job": { "namespace": "my-pipeline", "name": "daily_sales_rollup" }, "inputs": [ { "namespace": "arn:aws:glue:us-east-1:111122223333", "name": "table/sales_db/orders" } ], "outputs": [ { "namespace": "arn:aws:glue:us-east-1:111122223333", "name": "table/analytics/daily_sales" } ] }

AWS CLI

aws glue post-lineage-event \ --event file://event.json \ --region us-east-1

AWS SDK for Python (Boto3)

import json import boto3 glue = boto3.client("glue", region_name="us-east-1") event = {...} # the run event above glue.post_lineage_event(Event=json.dumps(event))

AWS SDK for Java 2.x

This example uses the open-source OpenLineage Java client (io.openlineage:openlineage-java) to build the RunEvent and convert it to JSON. You can also pass any OpenLineage event as a JSON string.

import io.openlineage.client.OpenLineageClientUtils; import software.amazon.awssdk.services.glue.model.PostLineageEventRequest; PostLineageEventRequest request = PostLineageEventRequest.builder() .event(OpenLineageClientUtils.toJson(runEvent)) .build(); glueClient.postLineageEvent(request);

Naming datasets

  • Data Catalog table. Namespace arn:aws:glue:<region>:<account-id>, name table/<database>/<table>.

  • Amazon S3. Namespace s3://<bucket>, name <prefix>.

  • Other sources. Follow the OpenLineage dataset naming conventions.

Use the same namespace and name for a dataset in every event, so that all events connect to the same node.

Best practices

  • Send a START event and a terminal event (COMPLETE, FAIL, or ABORT) with the same runId.

  • Keep job namespaces and names stable across runs, so that each run updates the same job node.

  • Include the schema and columnLineage dataset facets on outputs to get column lineage.

  • To declare a dataset without a job, such as a source table, send a dataset event.

  • Retry ThrottlingException and InternalServiceException with exponential backoff.

Limits

For limitations, see Considerations.