- Search Snowflake with SQL
- Search Snowflake with Cortex
Action Pack setup instructions
Set up a role to use
Option 1: Create a new Snowflake role with read-only access
A role is basically a group that grants specific permissions on certain resources. You may grant a role to a user or to another role (nested roles). First, we will create a new role called GLEAN_QUERY_SNOWFLAKE_ROLE. To do this, run the following queries with the ACCOUNTADMIN role or any role that can create roles and grant access to resources such as tables and Cortex:Create a Snowflake OAuth application
We will use the CREATE SECURITY INTEGRATION command to create the OAuth application. Use the ACCOUNTADMIN or any role that has permission to create a security integration:Option 2: Use an existing Snowflake role with read-only access
You can also use an existing role in the Scopes field when setting up your Action Pack. The action would use the access that the specified role has on your Snowflake instance. For example, your Scopes field could look like:Create Snowflake action pack
We will now set up the Snowflake action pack and update the redirect URI in the OAuth application:- Open Glean Settings page
- Go to Platforms > Actions
- Click on Add button for creating a new action
- Click on the Snowflake Actions box
- Populate the Configuration section
-
Set the account identifier field in the configuration. You may set it to the account identifier or account locator. This information can be found by navigating to the account details:
The accountIdentifier is the part before.snowflakecomputing.com
in your Snowflake URL. For example, if your URL ishttps://abc12345.us-east-1.snowflakecomputing.com
, the account identifier isabc12345.us-east-1
. -
For the Client URL and Authorization URL, run the following command in Snowflake to retrieve these values:
Look for the
OAUTH_AUTHORIZATION_ENDPOINT
andOAUTH_TOKEN_ENDPOINT
fields in the response: - Set the OAuth client id and client secret obtained from the previous step.
-
Set the account identifier field in the configuration. You may set it to the account identifier or account locator. This information can be found by navigating to the account details:
- Save the action.
- A callback URL is generated after saving the action. Use that to replace the redirect URL using the below command (with the same role as used for creating the OAuth app).