Area: Ingestion
Sub-Area: Query Engines
Applies to: OSS + Cloud
Issue
Lineage from Trino or Presto is missing. For example, you expect lineage from an INSERT INTO ... SELECT that runs across catalogs, or lineage from Trino tables to the underlying source tables is not showing.
You Might Be Asking
- How do I extract lineage from Trino queries?
- Why isn't cross-catalog lineage working?
- How do I map Trino catalogs to DataHub platforms?
Cause
The trino source does not read query history or parse INSERT statements. It produces lineage in two ways:
- From view definitions, which it parses with DataHub's SQL parser (
include_view_lineage). - From Trino datasets to the underlying datasets of the connector that backs each catalog (
ingest_lineage_to_connectors).
All three switches default to true: include_view_lineage, ingest_lineage_to_connectors and include_column_lineage. Column-level lineage to connectors is included when schema is available.
Recipes that use keys such as catalog_to_platform_map, include_table_lineage, include_usage_stats, query_log, platform_instance_map, event_log_path or system_tables fail validation, because the Trino config rejects keys it does not define. The database key is also required and has no default.
Connector lineage only appears when the URN built for the underlying dataset exactly matches the URN that the native platform's own ingestion produces. Trino lowercases identifiers, so mixed-case quoted names in the source system do not match.
Solution
1. Map catalogs to connector datasets
Set database to your Trino catalog. Use catalog_to_connector_details to describe each catalog. Each entry takes connector_database, connector_platform, platform_instance and env.
source:
type: trino
config:
# Add the connection settings for your Trino cluster here.
database: hive
catalog_to_connector_details:
postgresql:
connector_database: sales_db
platform_instance: prod
ingest_lineage_to_connectors: true
include_column_lineage: true
include_view_lineage: true
Supported connectors are clickhouse, hive, glue, iceberg, mysql, postgresql (DataHub platform postgres), redshift, bigquery, snowflake (snowflake_distributed, snowflake_parallel, snowflake_jdbc), oracle and starrocks.
- The clickhouse, hive, glue, mysql, iceberg and oracle connectors build two-tier (
schema.table) URNs. They do not needconnector_database. - Three-tier connectors, such as postgresql and starrocks, need
connector_database. - If you reach StarRocks through the
mysqlconnector, setconnector_platform: starrocksandconnector_database.
Set platform_instance per catalog in catalog_to_connector_details so it matches the platform instance you used when you ingested the underlying source.
If your cluster uses TLS, set options.connect_args.http_scheme: https. A BadStatusLine error usually means the server requires HTTPS.
The presto source type uses a config that extends the Trino config.
2. Get lineage from query text
To get lineage from SQL that ran on Trino, such as an INSERT INTO ... SELECT across catalogs, ingest the queries with the sql-queries source. It takes these keys:
-
query_file: the path to the file of queries. -
platform: required. Usetrino. -
default_dbanddefault_schema: optional.
source:
type: sql-queries
config:
query_file: ./trino_queries.json
platform: trino
See the SQL Queries source page for the file format.
3. Get usage
Trino and Starburst usage comes from the separate starburst-trino-usage source. It reads {audit_catalog}.{audit_schema}.completed_queries, the Starburst Event Logger table. Its keys are database, audit_catalog, audit_schema, email_domain and options.
4. Check your recipe
Run datahub recipe probe to check what a Trino recipe would ingest before you run it. Then confirm that the URNs for the underlying datasets match datasets that already exist in DataHub. See Connector lineage and siblings.