Snowflake
Snowflake Ingestion through the UI
The following video shows you how to ingest Snowflake metadata through the UI.
Read on if you are interested in ingesting Snowflake metadata using the datahub cli, or want to learn about all the configuration parameters that are supported by the connectors.
Module snowflake
Important Capabilities
Capability | Status | Notes |
---|---|---|
Asset Containers | ✅ | Enabled by default |
Column-level Lineage | ✅ | Enabled by default, can be disabled via configuration include_column_lineage |
Data Profiling | ✅ | Optionally enabled via configuration profiling.enabled |
Dataset Usage | ✅ | Enabled by default, can be disabled via configuration `include_usage_stats |
Descriptions | ✅ | Enabled by default |
Detect Deleted Entities | ✅ | Optionally enabled via stateful_ingestion.remove_stale_metadata |
Domains | ✅ | Supported via the domain config field |
Extract Tags | ✅ | Optionally enabled via extract_tags |
Platform Instance | ✅ | Enabled by default |
Schema Metadata | ✅ | Enabled by default |
Table-Level Lineage | ✅ | Enabled by default, can be disabled via configuration include_table_lineage and include_view_lineage |
Prerequisites
In order to execute this source, your Snowflake user will need to have specific privileges granted to it for reading metadata from your warehouse.
Snowflake system admin can follow this guide to create a DataHub-specific role, assign it the required privileges, and assign it to a new DataHub user by executing the following Snowflake commands from a user with the ACCOUNTADMIN
role or MANAGE GRANTS
privilege.
create or replace role datahub_role;
// Grant access to a warehouse to run queries to view metadata
grant operate, usage on warehouse "<your-warehouse>" to role datahub_role;
// Grant access to view database and schema in which your tables/views exist
grant usage on DATABASE "<your-database>" to role datahub_role;
grant usage on all schemas in database "<your-database>" to role datahub_role;
grant usage on future schemas in database "<your-database>" to role datahub_role;
// If you are NOT using Snowflake Profiling or Classification feature: Grant references privileges to your tables and views
grant references on all tables in database "<your-database>" to role datahub_role;
grant references on future tables in database "<your-database>" to role datahub_role;
grant references on all external tables in database "<your-database>" to role datahub_role;
grant references on future external tables in database "<your-database>" to role datahub_role;
grant references on all views in database "<your-database>" to role datahub_role;
grant references on future views in database "<your-database>" to role datahub_role;
// If you ARE using Snowflake Profiling or Classification feature: Grant select privileges to your tables
grant select on all tables in database "<your-database>" to role datahub_role;
grant select on future tables in database "<your-database>" to role datahub_role;
grant select on all external tables in database "<your-database>" to role datahub_role;
grant select on future external tables in database "<your-database>" to role datahub_role;
// Create a new DataHub user and assign the DataHub role to it
create user datahub_user display_name = 'DataHub' password='' default_role = datahub_role default_warehouse = '<your-warehouse>';
// Grant the datahub_role to the new DataHub user.
grant role datahub_role to user datahub_user;
The details of each granted privilege can be viewed in snowflake docs. A summarization of each privilege, and why it is required for this connector:
operate
is required on warehouse to execute queriesusage
is required for us to run queries using the warehouseusage
ondatabase
andschema
are required because without it tables and views inside them are not accessible. If an admin does the required grants ontable
but misses the grants onschema
or thedatabase
in which the table/view exists then we will not be able to get metadata for the table/view.- If metadata is required only on some schemas then you can grant the usage privilieges only on a particular schema like
grant usage on schema "<your-database>"."<your-schema>" to role datahub_role;
This represents the bare minimum privileges required to extract databases, schemas, views, tables from Snowflake.
If you plan to enable extraction of table lineage, via the include_table_lineage
config flag, extraction of usage statistics, via the include_usage_stats
config, or extraction of tags (without lineage), via the extract_tags
config, you'll also need to grant access to the Account Usage system tables, using which the DataHub source extracts information. This can be done by granting access to the snowflake
database.
grant imported privileges on database snowflake to role datahub_role;
Caveats
- Some of the features are only available in the Snowflake Enterprise Edition. This doc has notes mentioning where this applies.
- The underlying Snowflake views that we use to get metadata have a latency of 45 minutes to 3 hours. So we would not be able to get very recent metadata in some cases like queries you ran within that time period etc.
- If there is any incident going on for Snowflake we will not be able to get the metadata until that incident is resolved.
CLI based Ingestion
Install the Plugin
pip install 'acryl-datahub[snowflake]'
Starter Recipe
Check out the following recipe to get started with ingestion! See below for full configuration options.
For general pointers on writing and running a recipe, see our main recipe guide.
source:
type: snowflake
config:
# This option is recommended to be used to ingest all lineage
ignore_start_time_lineage: true
# Coordinates
account_id: "abc48144"
warehouse: "COMPUTE_WH"
# Credentials
username: "${SNOWFLAKE_USER}"
password: "${SNOWFLAKE_PASS}"
role: "datahub_role"
# (Optional) Uncomment and update this section to filter ingested datasets
# database_pattern:
# allow:
# - "^ACCOUNTING_DB$"
# - "^MARKETING_DB$"
profiling:
# Change to false to disable profiling
enabled: true
# This option is recommended to reduce profiling time and costs.
turn_off_expensive_profiling_metrics: true
# (Optional) Uncomment and update this section to filter profiled tables
# profile_pattern:
# allow:
# - "ACCOUNTING_DB.*.*"
# - "MARKETING_DB.*.*"
# Default sink is datahub-rest and doesn't need to be configured
# See https://datahubproject.io/docs/metadata-ingestion/sink_docs/datahub for customization options
Config Details
- Options
- Schema
Note that a .
is used to denote nested fields in the YAML recipe.
View All Configuration Options
Field [Required] | Type | Description | Default | Notes |
---|---|---|---|---|
account_id | string | Snowflake account identifier. e.g. xy12345, xy12345.us-east-2.aws, xy12345.us-central1.gcp, xy12345.central-us.azure, xy12345.us-west-2.privatelink. Refer Account Identifiers for more details. | None | |
apply_view_usage_to_tables | boolean | Allow/deny patterns for views in snowflake dataset names. | None | |
authentication_type | string | The type of authenticator to use when connecting to Snowflake. Supports "DEFAULT_AUTHENTICATOR", "EXTERNAL_BROWSER_AUTHENTICATOR" and "KEY_PAIR_AUTHENTICATOR". | DEFAULT_AUTHENTICATOR | |
bucket_duration | Enum | Size of the time window to aggregate usage stats. | DAY | |
check_role_grants | boolean | Not supported | None | |
connect_args | object | Connect args to pass to Snowflake SqlAlchemy driver | None | |
convert_urns_to_lowercase | boolean | True | ||
email_domain | string | Email domain of your organisation so users can be displayed on UI appropriately. | None | |
end_time | string(date-time) | Latest date of usage to consider. Default: Current time in UTC | None | |
extract_tags | Enum | Optional. Allowed values are without_lineage , with_lineage , and skip (default). without_lineage only extracts tags that have been applied directly to the given entity. with_lineage extracts both directly applied and propagated tags, but will be significantly slower. See the Snowflake documentation for information about tag lineage/propagation. | skip | |
format_sql_queries | boolean | Whether to format sql queries | None | |
host_port | string | DEPRECATED: Snowflake account. e.g. abc48144 | None | |
ignore_start_time_lineage | boolean | None | ||
include_column_lineage | boolean | If enabled, populates the column lineage. Supported only for snowflake table-to-table and view-to-table lineage edge (not supported in table-to-view or view-to-view lineage edge yet). Requires appropriate grants given to the role. | True | |
include_external_url | boolean | Whether to populate Snowsight url for Snowflake Objects | True | |
include_operational_stats | boolean | Whether to display operational stats. | True | |
include_read_operational_stats | boolean | Whether to report read operational stats. Experimental. | None | |
include_table_lineage | boolean | If enabled, populates the snowflake table-to-table and s3-to-snowflake table lineage. Requires appropriate grants given to the role and Snowflake Enterprise Edition or above. | True | |
include_table_location_lineage | boolean | If the source supports it, include table lineage to the underlying storage location. | True | |
include_tables | boolean | Whether tables should be ingested. | True | |
include_technical_schema | boolean | If enabled, populates the snowflake technical schema and descriptions. | True | |
include_top_n_queries | boolean | Whether to ingest the top_n_queries. | True | |
include_usage_stats | boolean | If enabled, populates the snowflake usage statistics. Requires appropriate grants given to the role. | True | |
include_view_lineage | boolean | If enabled, populates the snowflake view->table and table->view lineages (no view->view lineage yet). Requires appropriate grants given to the role, and include_table_lineage to be True. view->table lineage requires Snowflake Enterprise Edition or above. | True | |
include_views | boolean | Whether views should be ingested. | True | |
match_fully_qualified_names | boolean | Whether schema_pattern is matched against fully qualified schema name <catalog>.<schema> . | None | |
options | object | Any options specified here will be passed to SQLAlchemy's create_engine as kwargs. See https://docs.sqlalchemy.org/en/14/core/engines.html#sqlalchemy.create_engine for details. | None | |
password | string(password) | Snowflake password. | None | |
platform_instance | string | The instance of the platform that all assets produced by this recipe belong to | None | |
private_key | string | Private key in a form of '-----BEGIN PRIVATE KEY-----\nprivate-key\n-----END PRIVATE KEY-----\n' if using key pair authentication. Encrypted version of private key will be in a form of '-----BEGIN ENCRYPTED PRIVATE KEY-----\nencrypted-private-key\n-----END ECNCRYPTED PRIVATE KEY-----\n' See: https://docs.snowflake.com/en/user-guide/key-pair-auth.html | None | |
private_key_password | string(password) | Password for your private key. Required if using key pair authentication with encrypted private key. | None | |
private_key_path | string | The path to the private key if using key pair authentication. Ignored if private_key is set. See: https://docs.snowflake.com/en/user-guide/key-pair-auth.html | None | |
role | string | Snowflake role. | None | |
scheme | string | snowflake | ||
start_time | string(date-time) | Earliest date of usage to consider. Default: Last full day in UTC (or hour, depending on bucket_duration ) | None | |
store_last_profiling_timestamps | boolean | Enable storing last profile timestamp in store. | None | |
store_last_usage_extraction_timestamp | boolean | Enable checking last usage timestamp in store. | True | |
top_n_queries | integer | Number of top queries to save to each table. | 10 | |
upstream_lineage_in_report | boolean | None | ||
username | string | Snowflake username. | None | |
warehouse | string | Snowflake warehouse. | None | |
env | string | The environment that all assets produced by this connector belong to | PROD | |
classification | ClassificationConfig | For details, refer Classification. | None | |
classification.enabled | boolean | Whether classification should be used to auto-detect glossary terms | None | |
classification.info_type_to_term | map(str,string) | None | ||
classification.classifiers | array(object) | None | ||
classification.classifiers.type [❓ (required if classifiers is set)] | string | The type of the classifier to use. For DataHub, use datahub | None | |
classification.classifiers.config | object | The configuration required for initializing the classifier. If not specified, uses defaults for classifer type. | None | |
classification.column_pattern | AllowDenyPattern | Regex patterns to filter columns for classification. This is used in combination with other patterns in parent config. Specify regex to match the column name in database.schema.table.column format. | {'allow': ['.*'], 'deny': [], 'ignoreCase': True} | |
classification.column_pattern.allow | array(string) | None | ||
classification.column_pattern.deny | array(string) | None | ||
classification.column_pattern.ignoreCase | boolean | Whether to ignore case sensitivity during pattern matching. | True | |
classification.table_pattern | AllowDenyPattern | Regex patterns to filter tables for classification. This is used in combination with other patterns in parent config. Specify regex to match the entire table name in database.schema.table format. e.g. to match all tables starting with customer in Customer database and public schema, use the regex 'Customer.public.customer.*' | {'allow': ['.*'], 'deny': [], 'ignoreCase': True} | |
classification.table_pattern.allow | array(string) | None | ||
classification.table_pattern.deny | array(string) | None | ||
classification.table_pattern.ignoreCase | boolean | Whether to ignore case sensitivity during pattern matching. | True | |
database_pattern | AllowDenyPattern | {'allow': ['.*'], 'deny': ['^UTIL_DB$', '^SNOWFLAKE$', '^SNOWFLAKE_SAMPLE_DATA$'], 'ignoreCase': True} | ||
database_pattern.allow | array(string) | None | ||
database_pattern.deny | array(string) | None | ||
database_pattern.ignoreCase | boolean | Whether to ignore case sensitivity during pattern matching. | True | |
domain | map(str,AllowDenyPattern) | A class to store allow deny regexes | None | |
domain.key .allow | array(string) | None | ||
domain.key .deny | array(string) | None | ||
domain.key .ignoreCase | boolean | Whether to ignore case sensitivity during pattern matching. | True | |
oauth_config | OauthConfiguration | oauth configuration - https://docs.snowflake.com/en/user-guide/python-connector-example.html#connecting-with-oauth | None | |
oauth_config.authority_url | string | Authority url of your identity provider | None | |
oauth_config.client_id | string | client id of your registered application | None | |
oauth_config.client_secret | string | client secret of the application if use_certificate = false | None | |
oauth_config.encoded_oauth_private_key | string | base64 encoded private key content if use_certificate = true | None | |
oauth_config.encoded_oauth_public_key | string | base64 encoded certificate content if use_certificate = true | None | |
oauth_config.provider | string | Identity provider for oauth, e.g- microsoft | None | |
oauth_config.scopes | array(string) | None | ||
oauth_config.use_certificate | boolean | Do you want to use certificate and private key to authenticate using oauth | None | |
profile_pattern | AllowDenyPattern | Regex patterns to filter tables (or specific columns) for profiling during ingestion. Note that only tables allowed by the table_pattern will be considered. | {'allow': ['.*'], 'deny': [], 'ignoreCase': True} | |
profile_pattern.allow | array(string) | None | ||
profile_pattern.deny | array(string) | None | ||
profile_pattern.ignoreCase | boolean | Whether to ignore case sensitivity during pattern matching. | True | |
provision_role | SnowflakeProvisionRoleConfig | Not supported | None | |
provision_role.admin_username [❓ (required if provision_role is set)] | string | The username to be used for provisioning of role. | None | |
provision_role.admin_password | string(password) | The password to be used for provisioning of role. | None | |
provision_role.admin_role | string | The Snowflake role of admin user used for provisioning of the role specified by role config. System admins can audit the open source code and decide to use a different role. | accountadmin | |
provision_role.drop_role_if_exists | boolean | Useful during testing to ensure you have a clean slate role. Not recommended for production use cases. | None | |
provision_role.dry_run | boolean | If provision_role is enabled, whether to dry run the sql commands for system admins to see what sql grant commands would be run without actually running the grant commands. | None | |
provision_role.enabled | boolean | Whether provisioning of Snowflake role (used for ingestion) is enabled or not. | None | |
provision_role.run_ingestion | boolean | If system admins wish to skip actual ingestion of metadata during testing of the provisioning of role. | None | |
schema_pattern | AllowDenyPattern | Regex patterns for schemas to filter in ingestion. Specify regex to only match the schema name. e.g. to match all tables in schema analytics, use the regex 'analytics' | {'allow': ['.*'], 'deny': [], 'ignoreCase': True} | |
schema_pattern.allow | array(string) | None | ||
schema_pattern.deny | array(string) | None | ||
schema_pattern.ignoreCase | boolean | Whether to ignore case sensitivity during pattern matching. | True | |
table_pattern | AllowDenyPattern | Regex patterns for tables to filter in ingestion. Specify regex to match the entire table name in database.schema.table format. e.g. to match all tables starting with customer in Customer database and public schema, use the regex 'Customer.public.customer.*' | {'allow': ['.*'], 'deny': [], 'ignoreCase': True} | |
table_pattern.allow | array(string) | None | ||
table_pattern.deny | array(string) | None | ||
table_pattern.ignoreCase | boolean | Whether to ignore case sensitivity during pattern matching. | True | |
tag_pattern | AllowDenyPattern | List of regex patterns for tags to include in ingestion. Only used if extract_tags is enabled. | {'allow': ['.*'], 'deny': [], 'ignoreCase': True} | |
tag_pattern.allow | array(string) | None | ||
tag_pattern.deny | array(string) | None | ||
tag_pattern.ignoreCase | boolean | Whether to ignore case sensitivity during pattern matching. | True | |
user_email_pattern | AllowDenyPattern | regex patterns for user emails to filter in usage. | {'allow': ['.*'], 'deny': [], 'ignoreCase': True} | |
user_email_pattern.allow | array(string) | None | ||
user_email_pattern.deny | array(string) | None | ||
user_email_pattern.ignoreCase | boolean | Whether to ignore case sensitivity during pattern matching. | True | |
view_pattern | AllowDenyPattern | Regex patterns for views to filter in ingestion. Note: Defaults to table_pattern if not specified. Specify regex to match the entire view name in database.schema.view format. e.g. to match all views starting with customer in Customer database and public schema, use the regex 'Customer.public.customer.*' | {'allow': ['.*'], 'deny': [], 'ignoreCase': True} | |
view_pattern.allow | array(string) | None | ||
view_pattern.deny | array(string) | None | ||
view_pattern.ignoreCase | boolean | Whether to ignore case sensitivity during pattern matching. | True | |
profiling | GEProfilingConfig | {'enabled': False, 'limit': None, 'offset': None, 'report_dropped_profiles': False, 'turn_off_expensive_profiling_metrics': False, '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, 'include_field_mean_value': True, 'include_field_median_value': True, 'include_field_stddev_value': True, 'include_field_quantiles': False, 'include_field_distinct_value_frequencies': False, 'include_field_histogram': False, 'include_field_sample_values': True, 'field_sample_values_limit': 20, 'max_number_of_fields_to_profile': None, 'profile_if_updated_since_days': None, 'profile_table_size_limit': 5, 'profile_table_row_limit': 5000000, 'profile_table_row_count_estimate_only': False, 'max_workers': 20, 'query_combiner_enabled': True, 'catch_exceptions': True, 'partition_profiling_enabled': True, 'partition_datetime': None} | ||
profiling.catch_exceptions | boolean | True | ||
profiling.enabled | boolean | Whether profiling should be done. | None | |
profiling.field_sample_values_limit | integer | Upper limit for number of sample values to collect for all columns. | 20 | |
profiling.include_field_distinct_count | boolean | Whether to profile for the number of distinct values for each column. | True | |
profiling.include_field_distinct_value_frequencies | boolean | Whether to profile for distinct value frequencies. | None | |
profiling.include_field_histogram | boolean | Whether to profile for the histogram for numeric fields. | None | |
profiling.include_field_max_value | boolean | Whether to profile for the max value of numeric columns. | True | |
profiling.include_field_mean_value | boolean | Whether to profile for the mean value of numeric columns. | True | |
profiling.include_field_median_value | boolean | Whether to profile for the median value of numeric columns. | True | |
profiling.include_field_min_value | boolean | Whether to profile for the min value of numeric columns. | True | |
profiling.include_field_null_count | boolean | Whether to profile for the number of nulls for each column. | True | |
profiling.include_field_quantiles | boolean | Whether to profile for the quantiles of numeric columns. | None | |
profiling.include_field_sample_values | boolean | Whether to profile for the sample values for all columns. | True | |
profiling.include_field_stddev_value | boolean | Whether to profile for the standard deviation of numeric columns. | True | |
profiling.limit | integer | Max number of documents to profile. By default, profiles all documents. | None | |
profiling.max_number_of_fields_to_profile | integer | A positive integer that specifies the maximum number of columns to profile for any table. None implies all columns. The cost of profiling goes up significantly as the number of columns to profile goes up. | None | |
profiling.max_workers | integer | Number of worker threads to use for profiling. Set to 1 to disable. | 20 | |
profiling.offset | integer | Offset in documents to profile. By default, uses no offset. | None | |
profiling.partition_datetime | string(date-time) | For partitioned datasets profile only the partition which matches the datetime or profile the latest one if not set. Only Bigquery supports this. | None | |
profiling.partition_profiling_enabled | boolean | True | ||
profiling.profile_if_updated_since_days | number | Profile table only if it has been updated since these many number of days. If set to null , no constraint of last modified time for tables to profile. Supported only in snowflake and BigQuery . | None | |
profiling.profile_table_level_only | boolean | Whether to perform profiling at table-level only, or include column-level profiling as well. | None | |
profiling.profile_table_row_count_estimate_only | boolean | Use an approximate query for row count. This will be much faster but slightly less accurate. Only supported for Postgres. | None | |
profiling.profile_table_row_limit | integer | Profile tables only if their row count is less then specified count. If set to null , no limit on the row count of tables to profile. Supported only in snowflake and BigQuery | 5000000 | |
profiling.profile_table_size_limit | integer | Profile tables only if their size is less then specified GBs. If set to null , no limit on the size of tables to profile. Supported only in snowflake and BigQuery | 5 | |
profiling.query_combiner_enabled | boolean | This feature is still experimental and can be disabled if it causes issues. Reduces the total number of queries issued and speeds up profiling by dynamically combining SQL queries where possible. | True | |
profiling.report_dropped_profiles | boolean | Whether to report datasets or dataset columns which were not profiled. Set to True for debugging purposes. | None | |
profiling.turn_off_expensive_profiling_metrics | boolean | Whether to turn off expensive profiling or not. This turns off profiling for quantiles, distinct_value_frequencies, histogram & sample_values. This also limits maximum number of fields being profiled to 10. | None | |
stateful_ingestion | StatefulStaleMetadataRemovalConfig | Base specialized config for Stateful Ingestion with stale metadata removal capability. | None | |
stateful_ingestion.enabled | boolean | The type of the ingestion state provider registered with datahub. | None | |
stateful_ingestion.ignore_new_state | boolean | If set to True, ignores the current checkpoint state. | None | |
stateful_ingestion.ignore_old_state | boolean | If set to True, ignores the previous checkpoint state. | None | |
stateful_ingestion.remove_stale_metadata | boolean | Soft-deletes the entities present in the last successful run but missing in the current run with stateful_ingestion enabled. | True |
The JSONSchema for this configuration is inlined below.
{
"title": "SnowflakeV2Config",
"description": "Base configuration class for stateful ingestion for source configs to inherit from.",
"type": "object",
"properties": {
"store_last_profiling_timestamps": {
"title": "Store Last Profiling Timestamps",
"description": "Enable storing last profile timestamp in store.",
"default": false,
"type": "boolean"
},
"bucket_duration": {
"description": "Size of the time window to aggregate usage stats.",
"default": "DAY",
"allOf": [
{
"$ref": "#/definitions/BucketDuration"
}
]
},
"end_time": {
"title": "End Time",
"description": "Latest date of usage to consider. Default: Current time in UTC",
"type": "string",
"format": "date-time"
},
"start_time": {
"title": "Start Time",
"description": "Earliest date of usage to consider. Default: Last full day in UTC (or hour, depending on `bucket_duration`)",
"type": "string",
"format": "date-time"
},
"store_last_usage_extraction_timestamp": {
"title": "Store Last Usage Extraction Timestamp",
"description": "Enable checking last usage timestamp in store.",
"default": true,
"type": "boolean"
},
"top_n_queries": {
"title": "Top N Queries",
"description": "Number of top queries to save to each table.",
"default": 10,
"exclusiveMinimum": 0,
"type": "integer"
},
"user_email_pattern": {
"title": "User Email Pattern",
"description": "regex patterns for user emails to filter in usage.",
"default": {
"allow": [
".*"
],
"deny": [],
"ignoreCase": true
},
"allOf": [
{
"$ref": "#/definitions/AllowDenyPattern"
}
]
},
"include_operational_stats": {
"title": "Include Operational Stats",
"description": "Whether to display operational stats.",
"default": true,
"type": "boolean"
},
"include_read_operational_stats": {
"title": "Include Read Operational Stats",
"description": "Whether to report read operational stats. Experimental.",
"default": false,
"type": "boolean"
},
"format_sql_queries": {
"title": "Format Sql Queries",
"description": "Whether to format sql queries",
"default": false,
"type": "boolean"
},
"include_top_n_queries": {
"title": "Include Top N Queries",
"description": "Whether to ingest the top_n_queries.",
"default": true,
"type": "boolean"
},
"email_domain": {
"title": "Email Domain",
"description": "Email domain of your organisation so users can be displayed on UI appropriately.",
"type": "string"
},
"apply_view_usage_to_tables": {
"title": "Apply View Usage To Tables",
"description": "Allow/deny patterns for views in snowflake dataset names.",
"default": false,
"type": "boolean"
},
"env": {
"title": "Env",
"description": "The environment that all assets produced by this connector belong to",
"default": "PROD",
"type": "string"
},
"platform_instance": {
"title": "Platform Instance",
"description": "The instance of the platform that all assets produced by this recipe belong to",
"type": "string"
},
"stateful_ingestion": {
"$ref": "#/definitions/StatefulStaleMetadataRemovalConfig"
},
"options": {
"title": "Options",
"description": "Any options specified here will be passed to SQLAlchemy's create_engine as kwargs. See https://docs.sqlalchemy.org/en/14/core/engines.html#sqlalchemy.create_engine for details.",
"type": "object"
},
"schema_pattern": {
"title": "Schema Pattern",
"description": "Regex patterns for schemas to filter in ingestion. Specify regex to only match the schema name. e.g. to match all tables in schema analytics, use the regex 'analytics'",
"default": {
"allow": [
".*"
],
"deny": [],
"ignoreCase": true
},
"allOf": [
{
"$ref": "#/definitions/AllowDenyPattern"
}
]
},
"table_pattern": {
"title": "Table Pattern",
"description": "Regex patterns for tables to filter in ingestion. Specify regex to match the entire table name in database.schema.table format. e.g. to match all tables starting with customer in Customer database and public schema, use the regex 'Customer.public.customer.*'",
"default": {
"allow": [
".*"
],
"deny": [],
"ignoreCase": true
},
"allOf": [
{
"$ref": "#/definitions/AllowDenyPattern"
}
]
},
"view_pattern": {
"title": "View Pattern",
"description": "Regex patterns for views to filter in ingestion. Note: Defaults to table_pattern if not specified. Specify regex to match the entire view name in database.schema.view format. e.g. to match all views starting with customer in Customer database and public schema, use the regex 'Customer.public.customer.*'",
"default": {
"allow": [
".*"
],
"deny": [],
"ignoreCase": true
},
"allOf": [
{
"$ref": "#/definitions/AllowDenyPattern"
}
]
},
"profile_pattern": {
"title": "Profile Pattern",
"description": "Regex patterns to filter tables (or specific columns) for profiling during ingestion. Note that only tables allowed by the `table_pattern` will be considered.",
"default": {
"allow": [
".*"
],
"deny": [],
"ignoreCase": true
},
"allOf": [
{
"$ref": "#/definitions/AllowDenyPattern"
}
]
},
"domain": {
"title": "Domain",
"description": "Attach domains to databases, schemas or tables during ingestion using regex patterns. Domain key can be a guid like *urn:li:domain:ec428203-ce86-4db3-985d-5a8ee6df32ba* or a string like \"Marketing\".) If you provide strings, then datahub will attempt to resolve this name to a guid, and will error out if this fails. There can be multiple domain keys specified.",
"default": {},
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/AllowDenyPattern"
}
},
"include_views": {
"title": "Include Views",
"description": "Whether views should be ingested.",
"default": true,
"type": "boolean"
},
"include_tables": {
"title": "Include Tables",
"description": "Whether tables should be ingested.",
"default": true,
"type": "boolean"
},
"include_table_location_lineage": {
"title": "Include Table Location Lineage",
"description": "If the source supports it, include table lineage to the underlying storage location.",
"default": true,
"type": "boolean"
},
"profiling": {
"title": "Profiling",
"default": {
"enabled": false,
"limit": null,
"offset": null,
"report_dropped_profiles": false,
"turn_off_expensive_profiling_metrics": false,
"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,
"include_field_mean_value": true,
"include_field_median_value": true,
"include_field_stddev_value": true,
"include_field_quantiles": false,
"include_field_distinct_value_frequencies": false,
"include_field_histogram": false,
"include_field_sample_values": true,
"field_sample_values_limit": 20,
"max_number_of_fields_to_profile": null,
"profile_if_updated_since_days": null,
"profile_table_size_limit": 5,
"profile_table_row_limit": 5000000,
"profile_table_row_count_estimate_only": false,
"max_workers": 20,
"query_combiner_enabled": true,
"catch_exceptions": true,
"partition_profiling_enabled": true,
"partition_datetime": null
},
"allOf": [
{
"$ref": "#/definitions/GEProfilingConfig"
}
]
},
"scheme": {
"title": "Scheme",
"default": "snowflake",
"type": "string"
},
"username": {
"title": "Username",
"description": "Snowflake username.",
"type": "string"
},
"password": {
"title": "Password",
"description": "Snowflake password.",
"type": "string",
"writeOnly": true,
"format": "password"
},
"private_key": {
"title": "Private Key",
"description": "Private key in a form of '-----BEGIN PRIVATE KEY-----\\nprivate-key\\n-----END PRIVATE KEY-----\\n' if using key pair authentication. Encrypted version of private key will be in a form of '-----BEGIN ENCRYPTED PRIVATE KEY-----\\nencrypted-private-key\\n-----END ECNCRYPTED PRIVATE KEY-----\\n' See: https://docs.snowflake.com/en/user-guide/key-pair-auth.html",
"type": "string"
},
"private_key_path": {
"title": "Private Key Path",
"description": "The path to the private key if using key pair authentication. Ignored if `private_key` is set. See: https://docs.snowflake.com/en/user-guide/key-pair-auth.html",
"type": "string"
},
"private_key_password": {
"title": "Private Key Password",
"description": "Password for your private key. Required if using key pair authentication with encrypted private key.",
"type": "string",
"writeOnly": true,
"format": "password"
},
"oauth_config": {
"title": "Oauth Config",
"description": "oauth configuration - https://docs.snowflake.com/en/user-guide/python-connector-example.html#connecting-with-oauth",
"allOf": [
{
"$ref": "#/definitions/OauthConfiguration"
}
]
},
"authentication_type": {
"title": "Authentication Type",
"description": "The type of authenticator to use when connecting to Snowflake. Supports \"DEFAULT_AUTHENTICATOR\", \"EXTERNAL_BROWSER_AUTHENTICATOR\" and \"KEY_PAIR_AUTHENTICATOR\".",
"default": "DEFAULT_AUTHENTICATOR",
"type": "string"
},
"host_port": {
"title": "Host Port",
"description": "DEPRECATED: Snowflake account. e.g. abc48144",
"type": "string"
},
"account_id": {
"title": "Account Id",
"description": "Snowflake account identifier. e.g. xy12345, xy12345.us-east-2.aws, xy12345.us-central1.gcp, xy12345.central-us.azure, xy12345.us-west-2.privatelink. Refer [Account Identifiers](https://docs.snowflake.com/en/user-guide/admin-account-identifier.html#format-2-legacy-account-locator-in-a-region) for more details.",
"type": "string"
},
"warehouse": {
"title": "Warehouse",
"description": "Snowflake warehouse.",
"type": "string"
},
"role": {
"title": "Role",
"description": "Snowflake role.",
"type": "string"
},
"include_table_lineage": {
"title": "Include Table Lineage",
"description": "If enabled, populates the snowflake table-to-table and s3-to-snowflake table lineage. Requires appropriate grants given to the role and Snowflake Enterprise Edition or above.",
"default": true,
"type": "boolean"
},
"include_view_lineage": {
"title": "Include View Lineage",
"description": "If enabled, populates the snowflake view->table and table->view lineages (no view->view lineage yet). Requires appropriate grants given to the role, and include_table_lineage to be True. view->table lineage requires Snowflake Enterprise Edition or above.",
"default": true,
"type": "boolean"
},
"connect_args": {
"title": "Connect Args",
"description": "Connect args to pass to Snowflake SqlAlchemy driver",
"type": "object"
},
"check_role_grants": {
"title": "Check Role Grants",
"description": "Not supported",
"default": false,
"type": "boolean"
},
"database_pattern": {
"title": "Database Pattern",
"default": {
"allow": [
".*"
],
"deny": [
"^UTIL_DB$",
"^SNOWFLAKE$",
"^SNOWFLAKE_SAMPLE_DATA$"
],
"ignoreCase": true
},
"allOf": [
{
"$ref": "#/definitions/AllowDenyPattern"
}
]
},
"provision_role": {
"title": "Provision Role",
"description": "Not supported",
"allOf": [
{
"$ref": "#/definitions/SnowflakeProvisionRoleConfig"
}
]
},
"ignore_start_time_lineage": {
"title": "Ignore Start Time Lineage",
"default": false,
"type": "boolean"
},
"upstream_lineage_in_report": {
"title": "Upstream Lineage In Report",
"default": false,
"type": "boolean"
},
"convert_urns_to_lowercase": {
"title": "Convert Urns To Lowercase",
"default": true,
"type": "boolean"
},
"include_usage_stats": {
"title": "Include Usage Stats",
"description": "If enabled, populates the snowflake usage statistics. Requires appropriate grants given to the role.",
"default": true,
"type": "boolean"
},
"include_technical_schema": {
"title": "Include Technical Schema",
"description": "If enabled, populates the snowflake technical schema and descriptions.",
"default": true,
"type": "boolean"
},
"include_column_lineage": {
"title": "Include Column Lineage",
"description": "If enabled, populates the column lineage. Supported only for snowflake table-to-table and view-to-table lineage edge (not supported in table-to-view or view-to-view lineage edge yet). Requires appropriate grants given to the role.",
"default": true,
"type": "boolean"
},
"extract_tags": {
"description": "Optional. Allowed values are `without_lineage`, `with_lineage`, and `skip` (default). `without_lineage` only extracts tags that have been applied directly to the given entity. `with_lineage` extracts both directly applied and propagated tags, but will be significantly slower. See the [Snowflake documentation](https://docs.snowflake.com/en/user-guide/object-tagging.html#tag-lineage) for information about tag lineage/propagation. ",
"default": "skip",
"allOf": [
{
"$ref": "#/definitions/TagOption"
}
]
},
"classification": {
"title": "Classification",
"description": "For details, refer [Classification](../../../../metadata-ingestion/docs/dev_guides/classification.md).",
"allOf": [
{
"$ref": "#/definitions/ClassificationConfig"
}
]
},
"include_external_url": {
"title": "Include External Url",
"description": "Whether to populate Snowsight url for Snowflake Objects",
"default": true,
"type": "boolean"
},
"match_fully_qualified_names": {
"title": "Match Fully Qualified Names",
"description": "Whether `schema_pattern` is matched against fully qualified schema name `<catalog>.<schema>`.",
"default": false,
"type": "boolean"
},
"tag_pattern": {
"title": "Tag Pattern",
"description": "List of regex patterns for tags to include in ingestion. Only used if `extract_tags` is enabled.",
"default": {
"allow": [
".*"
],
"deny": [],
"ignoreCase": true
},
"allOf": [
{
"$ref": "#/definitions/AllowDenyPattern"
}
]
}
},
"additionalProperties": false,
"definitions": {
"BucketDuration": {
"title": "BucketDuration",
"description": "An enumeration.",
"enum": [
"DAY",
"HOUR"
],
"type": "string"
},
"AllowDenyPattern": {
"title": "AllowDenyPattern",
"description": "A class to store allow deny regexes",
"type": "object",
"properties": {
"allow": {
"title": "Allow",
"description": "List of regex patterns to include in ingestion",
"default": [
".*"
],
"type": "array",
"items": {
"type": "string"
}
},
"deny": {
"title": "Deny",
"description": "List of regex patterns to exclude from ingestion.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"ignoreCase": {
"title": "Ignorecase",
"description": "Whether to ignore case sensitivity during pattern matching.",
"default": true,
"type": "boolean"
}
},
"additionalProperties": false
},
"DynamicTypedStateProviderConfig": {
"title": "DynamicTypedStateProviderConfig",
"type": "object",
"properties": {
"type": {
"title": "Type",
"description": "The type of the state provider to use. For DataHub use `datahub`",
"type": "string"
},
"config": {
"title": "Config",
"description": "The configuration required for initializing the state provider. Default: The datahub_api config if set at pipeline level. Otherwise, the default DatahubClientConfig. See the defaults (https://github.com/datahub-project/datahub/blob/master/metadata-ingestion/src/datahub/ingestion/graph/client.py#L19)."
}
},
"required": [
"type"
],
"additionalProperties": false
},
"StatefulStaleMetadataRemovalConfig": {
"title": "StatefulStaleMetadataRemovalConfig",
"description": "Base specialized config for Stateful Ingestion with stale metadata removal capability.",
"type": "object",
"properties": {
"enabled": {
"title": "Enabled",
"description": "The type of the ingestion state provider registered with datahub.",
"default": false,
"type": "boolean"
},
"ignore_old_state": {
"title": "Ignore Old State",
"description": "If set to True, ignores the previous checkpoint state.",
"default": false,
"type": "boolean"
},
"ignore_new_state": {
"title": "Ignore New State",
"description": "If set to True, ignores the current checkpoint state.",
"default": false,
"type": "boolean"
},
"remove_stale_metadata": {
"title": "Remove Stale Metadata",
"description": "Soft-deletes the entities present in the last successful run but missing in the current run with stateful_ingestion enabled.",
"default": true,
"type": "boolean"
}
},
"additionalProperties": false
},
"GEProfilingConfig": {
"title": "GEProfilingConfig",
"type": "object",
"properties": {
"enabled": {
"title": "Enabled",
"description": "Whether profiling should be done.",
"default": false,
"type": "boolean"
},
"limit": {
"title": "Limit",
"description": "Max number of documents to profile. By default, profiles all documents.",
"type": "integer"
},
"offset": {
"title": "Offset",
"description": "Offset in documents to profile. By default, uses no offset.",
"type": "integer"
},
"report_dropped_profiles": {
"title": "Report Dropped Profiles",
"description": "Whether to report datasets or dataset columns which were not profiled. Set to `True` for debugging purposes.",
"default": false,
"type": "boolean"
},
"turn_off_expensive_profiling_metrics": {
"title": "Turn Off Expensive Profiling Metrics",
"description": "Whether to turn off expensive profiling or not. This turns off profiling for quantiles, distinct_value_frequencies, histogram & sample_values. This also limits maximum number of fields being profiled to 10.",
"default": false,
"type": "boolean"
},
"profile_table_level_only": {
"title": "Profile Table Level Only",
"description": "Whether to perform profiling at table-level only, or include column-level profiling as well.",
"default": false,
"type": "boolean"
},
"include_field_null_count": {
"title": "Include Field Null Count",
"description": "Whether to profile for the number of nulls for each column.",
"default": true,
"type": "boolean"
},
"include_field_distinct_count": {
"title": "Include Field Distinct Count",
"description": "Whether to profile for the number of distinct values for each column.",
"default": true,
"type": "boolean"
},
"include_field_min_value": {
"title": "Include Field Min Value",
"description": "Whether to profile for the min value of numeric columns.",
"default": true,
"type": "boolean"
},
"include_field_max_value": {
"title": "Include Field Max Value",
"description": "Whether to profile for the max value of numeric columns.",
"default": true,
"type": "boolean"
},
"include_field_mean_value": {
"title": "Include Field Mean Value",
"description": "Whether to profile for the mean value of numeric columns.",
"default": true,
"type": "boolean"
},
"include_field_median_value": {
"title": "Include Field Median Value",
"description": "Whether to profile for the median value of numeric columns.",
"default": true,
"type": "boolean"
},
"include_field_stddev_value": {
"title": "Include Field Stddev Value",
"description": "Whether to profile for the standard deviation of numeric columns.",
"default": true,
"type": "boolean"
},
"include_field_quantiles": {
"title": "Include Field Quantiles",
"description": "Whether to profile for the quantiles of numeric columns.",
"default": false,
"type": "boolean"
},
"include_field_distinct_value_frequencies": {
"title": "Include Field Distinct Value Frequencies",
"description": "Whether to profile for distinct value frequencies.",
"default": false,
"type": "boolean"
},
"include_field_histogram": {
"title": "Include Field Histogram",
"description": "Whether to profile for the histogram for numeric fields.",
"default": false,
"type": "boolean"
},
"include_field_sample_values": {
"title": "Include Field Sample Values",
"description": "Whether to profile for the sample values for all columns.",
"default": true,
"type": "boolean"
},
"field_sample_values_limit": {
"title": "Field Sample Values Limit",
"description": "Upper limit for number of sample values to collect for all columns.",
"default": 20,
"type": "integer"
},
"max_number_of_fields_to_profile": {
"title": "Max Number Of Fields To Profile",
"description": "A positive integer that specifies the maximum number of columns to profile for any table. `None` implies all columns. The cost of profiling goes up significantly as the number of columns to profile goes up.",
"exclusiveMinimum": 0,
"type": "integer"
},
"profile_if_updated_since_days": {
"title": "Profile If Updated Since Days",
"description": "Profile table only if it has been updated since these many number of days. If set to `null`, no constraint of last modified time for tables to profile. Supported only in `snowflake` and `BigQuery`.",
"exclusiveMinimum": 0,
"type": "number"
},
"profile_table_size_limit": {
"title": "Profile Table Size Limit",
"description": "Profile tables only if their size is less then specified GBs. If set to `null`, no limit on the size of tables to profile. Supported only in `snowflake` and `BigQuery`",
"default": 5,
"type": "integer"
},
"profile_table_row_limit": {
"title": "Profile Table Row Limit",
"description": "Profile tables only if their row count is less then specified count. If set to `null`, no limit on the row count of tables to profile. Supported only in `snowflake` and `BigQuery`",
"default": 5000000,
"type": "integer"
},
"profile_table_row_count_estimate_only": {
"title": "Profile Table Row Count Estimate Only",
"description": "Use an approximate query for row count. This will be much faster but slightly less accurate. Only supported for Postgres. ",
"default": false,
"type": "boolean"
},
"max_workers": {
"title": "Max Workers",
"description": "Number of worker threads to use for profiling. Set to 1 to disable.",
"default": 20,
"type": "integer"
},
"query_combiner_enabled": {
"title": "Query Combiner Enabled",
"description": "*This feature is still experimental and can be disabled if it causes issues.* Reduces the total number of queries issued and speeds up profiling by dynamically combining SQL queries where possible.",
"default": true,
"type": "boolean"
},
"catch_exceptions": {
"title": "Catch Exceptions",
"default": true,
"type": "boolean"
},
"partition_profiling_enabled": {
"title": "Partition Profiling Enabled",
"default": true,
"type": "boolean"
},
"partition_datetime": {
"title": "Partition Datetime",
"description": "For partitioned datasets profile only the partition which matches the datetime or profile the latest one if not set. Only Bigquery supports this.",
"type": "string",
"format": "date-time"
}
},
"additionalProperties": false
},
"OauthConfiguration": {
"title": "OauthConfiguration",
"type": "object",
"properties": {
"provider": {
"title": "Provider",
"description": "Identity provider for oauth, e.g- microsoft",
"type": "string"
},
"client_id": {
"title": "Client Id",
"description": "client id of your registered application",
"type": "string"
},
"scopes": {
"title": "Scopes",
"description": "scopes required to connect to snowflake",
"type": "array",
"items": {
"type": "string"
}
},
"use_certificate": {
"title": "Use Certificate",
"description": "Do you want to use certificate and private key to authenticate using oauth",
"default": false,
"type": "boolean"
},
"client_secret": {
"title": "Client Secret",
"description": "client secret of the application if use_certificate = false",
"type": "string"
},
"authority_url": {
"title": "Authority Url",
"description": "Authority url of your identity provider",
"type": "string"
},
"encoded_oauth_public_key": {
"title": "Encoded Oauth Public Key",
"description": "base64 encoded certificate content if use_certificate = true",
"type": "string"
},
"encoded_oauth_private_key": {
"title": "Encoded Oauth Private Key",
"description": "base64 encoded private key content if use_certificate = true",
"type": "string"
}
},
"additionalProperties": false
},
"SnowflakeProvisionRoleConfig": {
"title": "SnowflakeProvisionRoleConfig",
"type": "object",
"properties": {
"enabled": {
"title": "Enabled",
"description": "Whether provisioning of Snowflake role (used for ingestion) is enabled or not.",
"default": false,
"type": "boolean"
},
"dry_run": {
"title": "Dry Run",
"description": "If provision_role is enabled, whether to dry run the sql commands for system admins to see what sql grant commands would be run without actually running the grant commands.",
"default": false,
"type": "boolean"
},
"drop_role_if_exists": {
"title": "Drop Role If Exists",
"description": "Useful during testing to ensure you have a clean slate role. Not recommended for production use cases.",
"default": false,
"type": "boolean"
},
"run_ingestion": {
"title": "Run Ingestion",
"description": "If system admins wish to skip actual ingestion of metadata during testing of the provisioning of role.",
"default": false,
"type": "boolean"
},
"admin_role": {
"title": "Admin Role",
"description": "The Snowflake role of admin user used for provisioning of the role specified by role config. System admins can audit the open source code and decide to use a different role.",
"default": "accountadmin",
"type": "string"
},
"admin_username": {
"title": "Admin Username",
"description": "The username to be used for provisioning of role.",
"type": "string"
},
"admin_password": {
"title": "Admin Password",
"description": "The password to be used for provisioning of role.",
"type": "string",
"writeOnly": true,
"format": "password"
}
},
"required": [
"admin_username"
],
"additionalProperties": false
},
"TagOption": {
"title": "TagOption",
"description": "An enumeration.",
"enum": [
"with_lineage",
"without_lineage",
"skip"
],
"type": "string"
},
"DynamicTypedClassifierConfig": {
"title": "DynamicTypedClassifierConfig",
"type": "object",
"properties": {
"type": {
"title": "Type",
"description": "The type of the classifier to use. For DataHub, use `datahub`",
"type": "string"
},
"config": {
"title": "Config",
"description": "The configuration required for initializing the classifier. If not specified, uses defaults for classifer type."
}
},
"required": [
"type"
],
"additionalProperties": false
},
"ClassificationConfig": {
"title": "ClassificationConfig",
"type": "object",
"properties": {
"enabled": {
"title": "Enabled",
"description": "Whether classification should be used to auto-detect glossary terms",
"default": false,
"type": "boolean"
},
"table_pattern": {
"title": "Table Pattern",
"description": "Regex patterns to filter tables for classification. This is used in combination with other patterns in parent config. Specify regex to match the entire table name in `database.schema.table` format. e.g. to match all tables starting with customer in Customer database and public schema, use the regex 'Customer.public.customer.*'",
"default": {
"allow": [
".*"
],
"deny": [],
"ignoreCase": true
},
"allOf": [
{
"$ref": "#/definitions/AllowDenyPattern"
}
]
},
"column_pattern": {
"title": "Column Pattern",
"description": "Regex patterns to filter columns for classification. This is used in combination with other patterns in parent config. Specify regex to match the column name in `database.schema.table.column` format.",
"default": {
"allow": [
".*"
],
"deny": [],
"ignoreCase": true
},
"allOf": [
{
"$ref": "#/definitions/AllowDenyPattern"
}
]
},
"info_type_to_term": {
"title": "Info Type To Term",
"description": "Optional mapping to provide glossary term identifier for info type",
"default": {},
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"classifiers": {
"title": "Classifiers",
"description": "Classifiers to use to auto-detect glossary terms. If more than one classifier, infotype predictions from the classifier defined later in sequence take precedance.",
"default": [
{
"type": "datahub",
"config": null
}
],
"type": "array",
"items": {
"$ref": "#/definitions/DynamicTypedClassifierConfig"
}
}
},
"additionalProperties": false
}
}
}
Code Coordinates
- Class Name:
datahub.ingestion.source.snowflake.snowflake_v2.SnowflakeV2Source
- Browse on GitHub
Questions
If you've got any questions on configuring ingestion for Snowflake, feel free to ping us on our Slack