# Snowflake For context on getting started with ingestion, check out our [metadata ingestion guide](../README.md). ## Setup To install this plugin, run `pip install 'acryl-datahub[snowflake]'`. ### 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. You can 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: ```sql create or replace role datahub_role; // Grant privileges to use and select from your target warehouses / dbs / schemas / tables grant operate, usage on warehouse to role datahub_role; grant usage on to role datahub_role; grant usage on all schemas in database to role datahub_role; grant select on all tables in database to role datahub_role; grant select on all external tables in database to role datahub_role; grant select on all views in database to role datahub_role; // Grant privileges for all future schemas and tables created in a warehouse grant usage on future schemas in database "" to role datahub_role; grant select on future tables in 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 = ''; // Grant the datahub_role to the new DataHub user. grant role datahub_role to user datahub_user; ``` 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, you'll also need to grant privileges to access the Snowflake Account Usage views. You can execute the following using the `ACCOUNTADMIN` role to do so: ```sql grant imported privileges on database snowflake to role datahub_role; ``` ## Capabilities This plugin extracts the following: - Metadata for databases, schemas, views and tables - Column types associated with each table - Table, row, and column statistics via optional [SQL profiling](./sql_profiles.md) - Table lineage. :::tip You can also get fine-grained usage statistics for Snowflake using the `snowflake-usage` source described below. ::: | Capability | Status | Details | |-------------------|--------|------------------------------------------| | Platform Instance | ✔️ | [link](../../docs/platform-instances.md) | | Data Containers | ✔️ | | | Data Domains | ✔️ | [link](../../docs/domains.md) | ## Quickstart recipe Check out the following recipe to get started with ingestion! See [below](#config-details) for full configuration options. For general pointers on writing and running a recipe, see our [main recipe guide](../README.md#recipes). ```yml source: type: snowflake config: # Coordinates host_port: account_name warehouse: "COMPUTE_WH" # Credentials username: user password: pass role: "accountadmin" sink: # sink configs ``` ## Config details Like all SQL-based sources, the Snowflake integration supports: - Stale Metadata Deletion: See [here](./stateful_ingestion.md) for more details on configuration. - SQL Profiling: See [here](./sql_profiles.md) for more details on configuration. Note that a `.` is used to denote nested fields in the YAML recipe. | Field | Required | Default | Description | |--------------------------------|----------|----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `authentication_type` | | `"DEFAULT_AUTHENTICATOR"` | The type of authenticator to use when connecting to Snowflake. Supports `"DEFAULT_AUTHENTICATOR"`, `"EXTERNAL_BROWSER_AUTHENTICATOR"` and `"KEY_PAIR_AUTHENTICATOR"`. | | `username` | | | Snowflake username. | | `password` | | | Snowflake password. | | `private_key_path` | | | The path to the private key if using key pair authentication. See: https://docs.snowflake.com/en/user-guide/key-pair-auth.html | | `private_key_password` | | | Password for your private key if using key pair authentication. | | `host_port` | ✅ | | Snowflake host URL. | | `warehouse` | | | Snowflake warehouse. | | `role` | | | Snowflake role. | | `env` | | `"PROD"` | Environment to use in namespace when constructing URNs. | | `platform_instance` | | None | The Platform instance to use while constructing URNs. | | `options.