Skip to main content

Lineage Ingestion — Advanced Topics

This page covers entity resolution, cross-database lineage, stored procedure and view lineage, parallel processing, publishing, dialect mapping, and configuration. For the pipeline overview, SQL parsing, and graph analysis, see Lineage Ingestion.

Entity Resolution

Before publishing, table names from SQL must be resolved to OpenMetadata entities:
This resolution step is critical — lineage can only be created between entities that exist in the catalog.

Cross-Database Lineage

When processCrossDatabaseLineage is enabled:
Configured via crossDatabaseServiceNames in the workflow config.

Stored Procedure Lineage

lineage_processors.py handles lineage from stored procedures:
  1. Fetch stored procedure definitions
  2. Extract individual SQL statements from the procedure body
  3. Filter for lineage-relevant statements (is_lineage_query())
  4. Build a directed graph of the procedure’s data flow
  5. For each lineage edge, link to the stored procedure entity as the pipeline reference
The resulting lineage includes pipeline=EntityReference(type="storedProcedure") to show which procedure creates the data flow.

View Lineage

Views are processed separately:

External Table Lineage

ExternalTableLineageMixin (source/database/external_table_lineage_mixin.py) links external tables (S3, GCS paths) to database tables:
  1. Search for container entities by storage path
  2. Map columns between container and table
  3. Source: LineageSource.ExternalTableLineage

Parallel Processing

LineageSource processes queries in parallel for performance:
Thread count is configurable (default: CPU count). Each thread gets its own parser instances.

AddLineageRequest Structure

Publishing

The sink merges lineage with existing edges:
For views, write_override_lineage() replaces existing lineage entirely (since view definitions can change).

Dialect Mapping

lineage/models.py maps each database connection type to a SQL dialect for correct parsing:

Configuration

Key Design Patterns

Key Files Quick Reference

All paths above are relative to ingestion/src/metadata/ingestion/. For example, lineage/parser.py means ingestion/src/metadata/ingestion/lineage/parser.py.