Area: Ingestion Issues
Sub-Area: Oracle Source / SQL Aggregator / Lineage Parsing
Applies to: OSS + Cloud
Issue
You run Oracle ingestion with include_query_usage: true, which reads executed queries from Oracle's V$SQL view. Older DataHub CLI versions read the query text from V$SQL.SQL_TEXT. Oracle stores only the first 1,000 characters of each statement in that column. Any longer statement reaches DataHub cut off mid statement, and the SQL parser can't parse it. DataHub gets no lineage or usage from that query.
These parse failures don't appear as warnings or failures in the run summary. The run finishes with a success status and lineage is still missing. DataHub records the failures only as counters in the source report.
Older CLI versions also had these related problems on the same code path:
- Statements with an empty Oracle optimizer hint, such as
INSERT /*+ */ INTO ..., failed to parse. -
DELETEstatements counted as column-level lineage failures, which inflated the failure count. - Columns of type
SDO_GEOMETRY,SDO_POINT_TYPE,SDO_ELEM_INFO_ARRAY,SDO_ORDINATE_ARRAYandXMLTYPEwere ingested with an empty field type. - Query usage ignored the recipe's
schema_pattern,table_patternandview_pattern, so DataHub parsed queries against schemas you had excluded.
Error Messages
-
Failed to parse ' ' into Hint(empty optimizer hint) Can only generate column-level lineage for select-like inner statements, not <class 'sqlglot.expressions.dml.Delete'>-
Unable to map column types to DataHub types(an info entry in the report, for the spatial and XML columns above)
You Might Be Asking
- Why does my Oracle ingestion run succeed with no warnings while lineage is missing for many tables?
- Where can I see how many queries failed to parse?
- Is there a recipe setting that fixes truncated Oracle queries?
- Why do my
SDO_GEOMETRYandXMLTYPEcolumns have an empty field type?
Solution
Root Cause
V$SQL.SQL_TEXT holds only the first 1,000 characters of a statement. V$SQL.SQL_FULLTEXT is a CLOB that holds the complete statement. Older CLI versions parsed SQL_TEXT, so every statement over 1,000 characters failed to parse. This is a connector problem, not a recipe setting.
Fix: Upgrade the DataHub CLI
Upgrade to the latest DataHub CLI release. CLI 1.7.0.20 includes the fix.
- Upgrade the CLI where you run ingestion:
pip install --upgrade "acryl-datahub[oracle]"
- Check the installed version:
datahub version
-
If you run ingestion from the DataHub UI, set the CLI Version field in the ingestion source's advanced settings to the latest release. See UI Ingestion.
-
Run your Oracle recipe again. You don't need any recipe changes for the fix.
What the Fix Changes
- The connector reads
V$SQL.SQL_FULLTEXTand gets the complete statement. If DataHub can't read the CLOB for a row, it falls back toSQL_TEXTfor that row and adds the warning "Could not read full SQL text from V$SQL" to the run report. - The connector removes empty optimizer hints (
/*+ */) right afterSELECT,INSERT,UPDATE,DELETEorMERGEbefore parsing. - The parser no longer tries column-level lineage for
DELETEstatements, so they no longer add tonum_observed_queries_column_failed. -
SDO_GEOMETRY,SDO_POINT_TYPE,SDO_ELEM_INFO_ARRAYandSDO_ORDINATE_ARRAYmap to a record type.XMLTYPEmaps to a string type. - Query usage follows your
schema_pattern,table_patternandview_pattern, and attaches usage to the same dataset URNs the schema crawl creates.
Clean Up Orphan Datasets After Upgrading
Older versions could write usage to three-part <database>.schema.table dataset URNs that the schema crawl never created. This happened with add_database_name_to_urn: false (the default), or with add_database_name_to_urn: true plus service_name and no urn_db_name. These datasets show up without a container under a separate database in browse. After the upgrade, usage goes to the crawled datasets, but DataHub does not remove the old orphans.
To remove them, list the matches first with a dry run. A dry run prints the entities and deletes nothing:
datahub delete --platform oracle --entity-type dataset --query '<detected database>.*' --dry-run
Check that the list holds only the orphan datasets. --query can match more entities than you expect. Then run the same command without --dry-run. Without --hard, this is a soft delete, which you can undo. If your recipe uses add_database_name_to_urn: true with database or urn_db_name, your three-part datasets are real and need no cleanup.
Diagnosing Parse Failures
The run summary doesn't show parse failure counts. The full source report is at the end of the ingestion log, under Source (oracle) report:. In the DataHub UI, open the run's details and use Download Logs. Then search the sql_aggregator section for:
num_observed_queries
num_observed_queries_failed
num_observed_queries_column_failed
observed_query_parse_failures
observed_query_parse_failures lists sample errors with the first 100 characters of each failed query.
If You Can't Upgrade Yet
No recipe setting stops the truncation on older CLI versions. Oracle has no usage block and no max_query_duration setting, and the recipe fails validation if you add one. The V$SQL query has no time window. Your options:
- Set
include_query_usage: falseto stop readingV$SQL. This removes the parse failures and also removes query based usage. - Lower
max_queries_to_extract(default 1000, maximum 10000) to read fewer of the most recent queries. This lowers the number of failures but doesn't fix any single long query.
source:
type: oracle
config:
# ... connection settings ...
include_query_usage: true
max_queries_to_extract: 500
Additional Notes
- Only the
V$SQLquery usage path (include_query_usage: true) readsSQL_TEXT. Stored procedure and view lineage don't use it. - The connector reads the whole
SQL_FULLTEXTCLOB. Long statements are not cut at 4,000 characters. - Statements that the parser doesn't support still fail after the upgrade, and DataHub still reports them only in the source report counters, not as run warnings.