View a markdown version of this page

Lineage from Databricks Unity Catalog - AWS Glue

Lineage from Databricks Unity Catalog

An AWS Glue crawler can collect table and column lineage from Databricks Unity Catalog and add it to your lineage graph. The crawler reads the Unity Catalog lineage system tables through a SQL warehouse, so you don't install anything on your Databricks clusters.

How it works

On each scheduled run, the crawler queries system.access.table_lineage and system.access.column_lineage for new records, converts them to OpenLineage events, and sends them to AWS Glue Data Catalog. The crawler also reads system.information_schema.columns and system.query.history.

  • First run. Collects the last 7 days of lineage.

  • Later runs. Collect from the end of the previous run up to two hours before the current time, so the crawler picks up late records on the next run.

  • Gaps. If a run fails repeatedly, the crawler skips lineage older than 7 days.

Each crawl run reads query history up to two hours before the current time, because Databricks can take an hour or more to populate query history records.

Prerequisites

In Databricks, an administrator does the following once:

  1. Enable the system.access schema.

  2. Create a service principal with an OAuth secret.

  3. Grant the service principal SELECT on system.access.table_lineage and system.access.column_lineage, and CAN USE on a SQL warehouse.

  4. Add the service principal to the account-level databricks_pii_access group. This is required; without it, statements in query history are redacted.

To grant the service principal access to the system tables, run the following statements:

  1. Grant access to the system catalog: GRANT USE CATALOG ON CATALOG system TO principal;

  2. Grant access to the schema and all tables in it: GRANT USE SCHEMA, SELECT ON SCHEMA system.schema TO principal;

  3. Grant SELECT on a specific table: GRANT SELECT ON TABLE system.schema.table TO principal;

Replace principal with the service principal's application ID, schema with the system schema (for example, access), and table with the table name (for example, table_lineage).

Set up lineage collection

To set up lineage collection, do the following:

  1. Store the OAuth client secret in AWS Secrets Manager.

  2. Create an AWS Glue connection of type DATABRICKS with the workspace URL, SQL warehouse, secret ARN, and an Amazon S3 spill location.

  3. Create a crawler on the connection with lineage collection turned on, and set a schedule. Hourly is recommended.

  4. Give the crawler's IAM role glue:PostLineageEvent, glue:GetConnection, and secretsmanager:GetSecretValue on the secret.

Considerations

For limitations, see Considerations.