The Coefficient Snowflake connector comes with a visual query builder where you can select tables, columns, and filters, which we automatically translate into SQL query that is run on your Snowflake instance. In addition, you can supply custom SQL as well if you prefer to set up your import based on a Snowflake SQL query.
Option 1: Connect using Account Credentials
Configure Snowflake OAuth (For Snowflake Admins)
Import using a Custom SQL Query
Schedule your Import, Snapshots, and Add Automations
FAQs for Snowflake Integration
Connecting to Snowflake
Connecting Coefficient to your Snowflake instance has two options:
- Using Snowflake account credentials (username and password) OR
- Snowflake OAuth.
ℹ️ NOTE: Coefficient users should select the appropriate option based on their organization's access control, security, and data access governance requirements.
Option 1: Connect using Account Credentials
When connecting to Snowflake using your account credentials, Coefficient will need the following information: Snowflake Account Name, Database Name, Username, Password, and/or Warehouse Name.
1. Open the Coefficient Sidebar and click on the Menu. |
2. Select “Connected Sources”. |
3. Select “Add Connection” at the bottom and then “Connect” to Snowflake. |
4. Enter your Snowflake Account Name and Database Name. ℹ️ NOTE: When entering your Account Name, you may need to include the region ID and/or cloud platform (AWS, Azure, GCP). For details, see Account Locator in a Region (Snowflake Documentation). |
5. Enter your credentials. If your Snowflake instance has network policies configured with IP restrictions, you will need to whitelist (ALL 3) Coefficient's server IP addresses. (34.217.184.131, 44.234.233.60, 52.32.132.51) For details, see Network Policies (Snowflake Documentation).
|
6. If you want to use a different Snowflake Warehouse or don’t have a default warehouse assigned to your account, you can manually enter it by clicking the “Advanced Settings” link. ℹ️ NOTE: You can leave this section blank, and Coefficient automatically connects to your default warehouse. |
7. ℹ️ OPTIONAL: Once the connection is made, you will see an optional setting allowing you to share your Snowflake connection with your team. Your password will never be visible to your team members. |
Option 2: Connect using OAuth
Snowflake OAuth allows users from your organization to use their individual Snowflake logins to connect to your Snowflake instance — without needing to enter their Snowflake username/password directly. This is particularly useful if your organization’s end users sign in to Snowflake using a third-party SSO provider such as Okta, OneLogin, or Azure Active Directory.
ℹ️ NOTE: Your Snowflake Admin needs to configure the Snowflake OAuth for your domain first to be able to use this feature.
Configure Snowflake OAuth (For Snowflake Admins)
1. Open the Coefficient Sidebar and click on the Menu. |
2. Select “Connected Sources”. |
3. Select “Add Connection” at the bottom and then “Connect” to Snowflake. |
4. Click the “connect using Snowflake OAuth” link. |
5. Click “Configure”. |
6. You will then be redirected to the Snowflake OAuth Configuration page. Follow the instructions below and save the configuration.
ℹ️ Click here to learn more about configuring Snowflake OAuth.
Connect using Snowflake OAuth
1. Open the Coefficient Sidebar and click on the Menu. |
2. Select “Connected Sources”. |
3. Select “Add Connection” at the bottom and then “Connect” to Snowflake. |
4. If your domain’s Snowflake OAuth is properly configured, the Account is automatically populated, and you only need to enter the Database name and/or Warehouse name (Optional). Click “Authorize” to proceed. |
5. Sign in to your Snowflake account. If successful, you can now proceed with creating Snowflake imports using Coefficient. 😎 |
Import from Snowflake
There are several ways to import data from Snowflake; let's go through each one!
- Import from Tables & Columns
- Import using a Custom SQL Query
- Import from GPT SQL Builder
Import from Tables & Columns
1. Open the Coefficient Sidebar and click on the “Import from…” button. |
2. Select “Snowflake” from the list. |
3. Select "From Tables & Columns". |
4. The Import Preview window shows all the table schemas from your Snowflake instance. Select the table for your import. (i.e. ”call_center”)
5. Select/Unselect the fields you need for your import on the left side of the Import Preview window. The data preview section updates as you change your settings (the first 50 rows of data are shown). You can drag and drop column headers to change their order in your import.
6. Customize your import by adding filters and row limits as needed. When done, click “Import”.
7. Congratulations on your successful import from a Snowflake table. 🎉
Import using a Custom SQL Query
1. Open the Coefficient Sidebar and click the “Import from…” button. |
2. Select “Snowflake” from the list. |
3. Select "Custom SQL Query". |
4. The Import Preview window pops up; you can add your Snowflake query in the blue text area provided. You can also use a SQL Parameter or GPT SQL Builder for your query. Only the first 50 rows of data are shown in the data preview section.
ℹ️ Click here to learn more about Snowflake Query Syntax.
5. Make sure to give your import a name, then hit "Import".
6. Hooray! Congratulations on your Custom SQL Query import from Snowflake! 🎉
Import from GPT SQL Builder
1. Open the Coefficient Sidebar and click on the “Import from…” button. |
2. Select “Snowflake” from the list. |
3. Select "GPT SQL Builder" |
4. Enter the prompt/query you would like the AI to build for you. Once you are done, click on "Generate SQL".
Example: Show all information from the tpcds_sf100tcl.inventory table where quantity on hand is greater than 500."
ℹ️ PRO TIP: Be specific when adding your prompts. It will help the AI to understand your requirements and provide accurate results easily.
5. The AI automatically generates the SQL query, which you can modify if necessary. Click the "Refresh Preview" button to display a sample of the data results (only 50 rows are shown). Click "Import" when you are done. And... VOILA!🪄 Your Snowflake import, assisted by the GPT SQL Builder, is now ready. 🎉
Schedule your Import, Snapshots, and Add Automations
Once you have pulled your data into your sheet using Coefficient, you can set up the following:
|
FAQs for Snowflake Integration
Do I need a Username and Password to connect to Snowflake? What if my company uses an SSO (Single Sign-On) like Okta?
You now have the option to create your Snowflake connection and log in using your account credentials (username and password) or sign in through SSO. Please contact your Snowflake Admin to configure SSO with Coefficient (see the steps on configuring your Snowflake OAuth here).
How long does Coefficient connect to my Snowflake instance?
When Coefficient needs to run a query, we establish a connection to your database, run the query on your behalf, and terminate the connection once the query completes.
Why is the initial connection to Snowflake so slow?
When initially connecting to Snowflake, it may take a few minutes for Coefficient to fetch your database schema: table/view definitions, column names, etc. We cache this information, so setting up subsequent Snowflake imports should feel much snappier.
I keep getting an error “No default warehouse for Snowflake user” when I try to connect to my server. What should I do?
- Make sure that your user account has a default warehouse assigned to it. Run the script SHOW WAREHOUSES; on your DB to list all your available warehouses. To assign a default warehouse to your user account, run the following command: ALTER USER <user_name> SET DEFAULT_WAREHOUSE = <warehouse_name>;
- There may be instances where your account is assigned to a specific role and it needs to be granted usage to the default warehouse. To do that, run the below script: GRANT USAGE ON WAREHOUSE <warehouse_name> TO ROLE <role_name>;
- In other cases where your connection is still not working even after running the above scripts, please ask your DB Admin to run the scripts above using their own credentials and make sure that your account and role have a default warehouse assigned to them.
What Role/s in Snowflake does Coefficient use to create the data connection?
Each time our systems establish a connection to your Snowflake instance, the underlying SQL connection is made using your Snowflake user’s default primary role and default secondary role. If you need to activate a non-default primary or secondary role, you can create your Coefficient Snowflake import using the “Custom SQL Query” option and include the appropriate USE ROLE/USE SECONDARY ROLES statements in your SQL query.
I added a table (or column) in my Snowflake database; why is it not showing up in Coefficient?
To deliver a snappy experience when you set up imports from Snowflake, we cache your database schema for up to 24 hours. If you recently changed your database schema (e.g., added a table/column, renamed a table/column, etc.), and you don't see the change reflected in Coefficient, you can force a schema reload:
- Open the Coefficient sidebar in Google Sheets/Excel.
- Click on the menu icon in the top right of the sidebar, then click on “Connected Sources”.
- Click on your Snowflake connection to see its Connection Settings page.
- Click on the︙button near the top right, choose “Reload Schema”, and click “Reload” on the confirmation dialog.
My custom SQL script seems to run longer than expected and sometimes, I see a "SQL Error - canceling statement due to statement timeout" error when I refresh my import, what should I do?
The error message you're seeing indicates that the SQL query you're trying to execute is being canceled due to a statement timeout. This means that the query is taking too long to execute, and your database server is configured to cancel any query that exceeds a certain execution time threshold.
Here are some steps you can take to understand and fix this issue:
- Examine the Execution Plan: Use the EXPLAIN command to get the execution plan for your query. This will show you where the query might be inefficient, such as performing full table scans or using nested loops that could be optimized. (Click here to learn more about the EXPLAIN command with Snowflake).
- Optimize the Query: Look for ways to make the query more efficient. This could involve adding indexes to the columns used in the WHERE clause and the ILIKE conditions, rewriting the query to reduce complexity, or breaking it into smaller parts.
- Reduce the Dataset: If possible, limit the scope of the query. For example, if you're querying a large date range or a large number of rows, see if you can reduce that range with LIMIT.
- Increase the Statement Timeout (not recommended): If you control the database server settings, you can increase the statement timeout value. This temporary solution may not be ideal if the query is inherently inefficient.
I keep getting a timeout error with my Snowflake imports. What could be causing this, and how can I fix it?
When running complex SQL queries with multiple joins, the joins can take significant time to process, which may result in timeout errors. To minimize this, we recommend optimizing your queries by adding filters, setting limits, or reducing the number of columns in your query. Also, you can explore using Materialized Views or other optimization techniques to improve performance, as suggested in this article. |
|
I'm getting an "Invalid consent request" error when connecting to Snowflake. What do I do?
This error typically occurs when the authentication role is either incorrect or not assigned to the user. To resolve this issue, please follow these steps:
Verify the correct role name by running the following Snowflake command to list all available roles:
sql SHOW ROLES;
Next, ensure that the role name matches exactly as it appears in the output. Since role names are case-sensitive, double-check the capitalization.
Verify that the role has been granted to the user establishing the connection. Run the following command to check the roles assigned to the user:
sql SHOW GRANTS TO USER '<username>';
Replace <username> with the actual user's name. Confirm that the intended role appears in the list of grants for that user.
When you enter the role in the authorization URL, please ensure the role name matches exactly as shown in the output of the SHOW ROLES command, including proper capitalization. Incorrect capitalization or selecting the wrong role may result in connection errors.