Area: Ingestion Issues
Sub-Area: Snowflake Connector, Lineage Payload Size and Query Entity URNs
Applies to: OSS + Cloud
Issue
A Snowflake ingestion run fails with HTTP 400 errors when the CLI sends metadata to DataHub GMS. Only a few datasets or query entities fail. The run summary shows one or both of these failure types:
- A failure whose
workunit_idends in-upstreamLineage, with the messageUnable to emit metadata to DataHub GMS: Cannot parse request entity. - A failure for a query entity whose URN starts with
urn:li:query:view_urn%3A, for example aworkunit_idlikeurn:li:query:view_urn%3Ali%3Adataset%3A%28...%29-dataPlatformInstance.
You Might Be Asking
- Why does my Snowflake ingestion fail with HTTP 400 for only a few assets?
- Will
incremental_lineage: falsefix theupstreamLineagefailure? - Is the URN in the error the cause of the failure?
- Does upgrading the CLI to 1.6.0 fix the 400?
Cause
400 Cannot parse request entity means GMS rejected a request that was too large to parse. GMS rejects the request when it breaks one of these limits:
- A string is larger than 16 MB.
- A JSON key (property name) is longer than 50,000 characters.
Large upstreamLineage aspects and incremental_lineage patches often cause this. A view or table with many direct upstreams or column lineage edges produces a large aspect. Long column transform expressions in incremental lineage patches can push a property name over the key limit. A dataset's upstreamLineage aspect holds only its direct upstreams and column-level lineage. Downstream dependents and lineage depth don't change its size.
The URN in the error may not be the cause. The CLI sends many workunits in one batch, and the whole batch fails together. One oversized item makes every item in the batch fail. GMS does not return the original parse error, so the error can't tell you which item was too large.
Solution
Step 1: Identify the failure
- Open the failed ingestion run and look at the failure entries.
- Note any
workunit_idthat ends in-upstreamLineageor starts withurn:li:query:view_urn%3A. These datasets may not be the cause, but they show where the failing batch was.
Step 2: Apply a fix
Use one of these fixes first.
-
Upgrade the server. The fix raises the server limit on JSON property name length.
- DataHub Cloud: upgrade to v2.1.0 or later. Contact DataHub Support to ask about upgrading your Cloud instance.
- Self-hosted OSS: upgrade to v1.7.0 or later. The raised limit is not in v1.6.0 or earlier.
-
Set
incremental_lineage: falsein your Snowflake recipe as a workaround. This stops the CLI from sending the large incremental lineage patches.
source:
type: snowflake
config:
# ... other config ...
incremental_lineage: false
With incremental_lineage: false, the last source to write a dataset's lineage wins. If more than one source writes lineage for the same dataset, the lineage from earlier sources is replaced.
Step 3: Use other options if needed
- Upgrade the CLI to the latest release. The CLI trims an
upstreamLineageaspect or lineage patch when its total size is too large. The run then logs the warningUpstream lineage truncated due to size constraintinstead of failing. This does not help with a single property name over 50,000 characters, such as a long column transform expression. For that case, use a fix from Step 2.- Check the CLI version your runs use with
datahub version. - For ingestion that runs from the DataHub UI, edit the ingestion source and set CLI Version under Advanced Settings. See UI ingestion.
- For ingestion you run with the CLI, run
pip install --upgrade acryl-datahub.
- Check the CLI version your runs use with
- If you can't upgrade yet, exclude the failing dataset from ingestion. Use
view_patternfor a view andtable_patternfor a table. Both match the fulldatabase.schema.name. If you settable_patternand leaveview_patternunset, DataHub appliestable_patternto views too.
source:
type: snowflake
config:
# ... other config ...
view_pattern:
deny:
- "<your_database>\\.<your_schema>\\.<your_view_name>"
If your recipe has stateful ingestion with remove_stale_metadata turned on, the next successful run soft-deletes the excluded dataset in DataHub. Remove the deny entry after you fix the cause.
More executor memory doesn't help, because GMS rejects the request, not the executor.
See the Snowflake source configuration for view_pattern, table_pattern and incremental_lineage.
Note: view query URNs
CLI 1.5.0.1 and later shorten the IDs of view query entities. Older CLIs build the ID from the full URL-encoded view URN. The shorter IDs help, but they did not fix the reported case. Upgrading the CLI to 1.6.0 alone does not fix the 400.
Step 4: Re-run and check
- Re-run the ingestion source.
- Confirm the run has no failures for the datasets and query entities from Step 1.
- Open the affected datasets and confirm their lineage shows in DataHub.