Area: Ingestion
Sub-Area: Snowflake
Applies to: OSS + Cloud
Issue
When you ingest from Snowflake with tags enabled, extract_tags: with_lineage returns no tags, but extract_tags: without_lineage returns tags.
You Might Be Asking
- Why aren't Snowflake tags appearing with
extract_tags: with_lineage? - What is the difference between
with_lineageandwithout_lineage? - What privileges does tag extraction need?
- How long does it take for new tags to appear?
Cause
extract_tags accepts without_lineage, with_lineage and skip (the default).
-
without_lineageextracts only tags applied directly to an object. -
with_lineagealso attaches tags propagated or inherited from the parent database, schema or table. The config describes it as significantly slower. Neither mode creates lineage edges.
How each mode reads tags depends on your CLI version:
-
CLI 1.5.0 and later: Both modes read
SNOWFLAKE.ACCOUNT_USAGE.TAG_REFERENCES, once per database.with_lineageonly adds the inherited tags in memory. Both modes needIMPORTED PRIVILEGESon theSNOWFLAKEdatabase. Both have the same delay, because the DataHub docs say ACCOUNT_USAGE views have a latency of 45 minutes to 3 hours. -
Before CLI 1.5.0: The modes read different sources.
with_lineagecalled per-databaseINFORMATION_SCHEMAtag_references table functions, andwithout_lineagereadACCOUNT_USAGE.TAG_REFERENCES. On CLI 1.5.0 and later, theINFORMATION_SCHEMAtable functions are gone, so upgrading removes that code path.
If loading tags fails for a database, the run continues without tags for that database. The run report shows a warning titled Failed to load tags for database with the message Tag extraction will be skipped for this database. Check that the ingestion role has access to SNOWFLAKE.ACCOUNT_USAGE.TAG_REFERENCES. The log also has a line starting Failed to load tag cache for database. The warning appears in the run summary in the UI.
Solution
-
Upgrade to the latest CLI release (1.7.0.20 at the time of writing). For Cloud UI ingestion, set the version under the source's Advanced Settings, CLI Version. From CLI 1.5.0 on, both modes behave the same for privileges and delay. See UI ingestion Advanced Settings.
-
Grant the DataHub role access to the ACCOUNT_USAGE views. See Snowflake prerequisites and grants.
grant imported privileges on database snowflake to role datahub_role; -
Choose the mode:
- Use
without_lineageif you need only directly applied tags. - Use
with_lineageif you also need tags inherited from the parent database, schema or table.
source: type: snowflake config: account_id: ${SNOWFLAKE_ACCOUNT} extract_tags: with_lineage # other connection options - Use
-
Wait for the ACCOUNT_USAGE delay (45 minutes to 3 hours) after you tag objects, then run ingestion again.
-
Check the run's warnings for
Failed to load tags for database. To see full logs, turn on Debug Mode under the source's Advanced Settings, or rundatahub --debug ingest -c recipe.yaml.
To filter which tags are ingested, use tag_pattern. To ingest key-value tags as structured properties instead of DataHub tags, set extract_tags_as_structured_properties: true (default false).