Area: Ingestion
Sub-Area: Profiling
Applies to: OSS + Cloud
Issue
Column-level statistics (such as null counts, distinct values, min and max values) don't appear in DataHub after Snowflake ingestion, even though table-level metadata is ingested. Or the stats appear but don't seem to match the row count.
You Might Be Asking
- Why do I see no column stats at all?
- Why do the column stats not match the row count?
- Where do I see column stats in the UI?
Cause
Profiling is off by default (profiling.enabled: false), so a recipe without a profiling block ingests no stats. Other common causes:
- Profiling needs
include_technical_schema: true. If it is false, recipe validation fails. - The role has no SELECT on the tables. Profiling needs SELECT on all and future tables, external tables and dynamic tables. REFERENCES alone is enough only when you don't profile.
-
profile_patternis matched against the full<database>.<schema>.<table>name, and only tables thattable_patternallows are considered. A pattern that holds only a table name matches nothing. - Snowflake profiling skips large tables by default:
profile_table_size_limitdefaults to 5 (GB) andprofile_table_row_limitdefaults to 5,000,000 rows. -
profile_if_updated_since_daysskips tables that did not change in the last N days. - The Snowflake connector never profiles views, so a view has no profile and no stats. No setting turns on view profiling. External tables are skipped unless
profiling.profile_external_tablesis true.
If stats exist but the numbers look wrong, the usual cause is sampling. See step 4.
Solution
-
Enable profiling. Setting
profiling.enabled: truealone turns on column-level stats.profile_table_level_onlyand theinclude_field_*options below already default to the values shown.
source:
type: snowflake
config:
# ... connection config ...
profiling:
enabled: true
profile_table_level_only: false
include_field_null_count: true
include_field_distinct_count: true
include_field_min_value: true
include_field_max_value: true
# Optional: limit profiling to specific tables.
# profile_pattern sits beside profiling, not inside it.
profile_pattern:
allow:
- 'analytics\.public\..*'
-
profile_patternis a top-level source option. Nesting it underprofilingfails validation. -
profile_patternalways sees the three-part name<database>.<schema>.<table>. With the defaultconvert_urns_to_lowercase: truethe name is lowercased, and patterns ignore case by default.match_fully_qualified_namesdoes not change this. - Patterns are Python regular expressions. They match from the start of the name. Deny wins over allow.
- Examples:
'analytics\.public\..*'profiles every table in schema PUBLIC of database ANALYTICS.'.*\.public\..*'profiles PUBLIC schemas in any database.'analytics\.public\.orders$'profiles one table. Without the$it would also matchorders_archive. - In a pattern,
.is a regex wildcard. Escape it as\.to match a literal dot, and put the pattern in single quotes. In a double-quoted YAML string\.is not a valid escape and the recipe file fails to load. - The run report counts tables that
profile_patternskipped, per schema, inprofiling_skipped_table_profile_pattern. Use it to check that your pattern matched what you expected. -
profiling.max_workersonly sets the number of profiling threads (default 5 x CPU count, set to 1 to disable). It sits inside theprofilingblock and does not affect accuracy.
-
Check Snowflake grants. Grant the following to the role (see the prerequisites link below for the full statements):
-
operate, usageon the warehouse. -
usageon the database and on all and future schemas. -
selecton all and future tables, external tables and dynamic tables.
-
-
Check for skipped tables. A table over
profile_table_size_limit(default 5 GB) orprofile_table_row_limit(default 5,000,000) still gets a table-level profile. The profile has the row count and size, but no column statistics. The run report counts these tables inprofiling_skipped_size_limitorprofiling_skipped_row_limit. If you need column statistics on those tables, raise the limits or set either one tonull. If you setprofile_if_updated_since_days, check its value. To profile external tables, setprofiling.profile_external_tables: true. -
Understand sampling. On Snowflake,
use_samplingdefaults to true andsample_sizedefaults to 10000. For tables with more rows thansample_size, column stats cover only the sample, whilerowCountcovers the whole table and comes from Snowflake metadata. SonullCountis not a fraction ofrowCount. UsenullProportion.uniqueCountis the sample's distinct count and is not scaled up. Tables at or belowsample_sizeare profiled in full, and theirrowCountcomes from aCOUNT(*). Setuse_sampling: falseto compute stats on the full table, at higher warehouse cost. -
Check the UI. Open the dataset and look at the Columns tab, or the Stats tab. The Stats tab is enabled when a full-table profile, a partition profile, usage stats or operations exist. DataHub Cloud v0.3.11 changed the Stats tab query so it also finds the latest sampled profile. That was a UI query change only. No profiler change shipped in that release.
-
Look at the run. Run with
datahub --debug ingest -c recipe.yaml. For UI ingestion, turn on Debug Mode under the source's Advanced Settings. Check the run report for warnings.