Select a value

Snowflake

1. Create your Commonality role

Ensure that your account is set to ACCOUNTADMIN and navigate to the "Roles" tab on the "Account" screen. Click on "+ Create" to display the role creation modal.

Here we'll create the role that will allow us to connect to our data. This role will inherit permissions from the SYSADMIN role.

2. Create your Commonality user

Next, navigate to the "Users" tab on the same account screen as before.

Click on "+Create" and enter a name and password for the new user. We'll use these credentials later to connect to your Snowflake instance so keep note of your username and password. You'll want to ensure that "Force Password Change" is not checked.

Before we finish the creation of our user, click on "Next" twice to navigate to the "Preferences" tab of the modal.

3. Grant permissions to your Commonality role and user

Now let's grant permissions for our new user and role to access the databases and warehouses that you'd like to use within Commonality.

Navigate to the "Worksheets" screen and enter the following query. Change my_database and my_warehouse to the corresponding database and warehouse that you'd like to use within Commonality. If you used different user or role names you'll need to change the names within the query as well.

GRANT ROLE COMMONALITY_READ TO USER COMMONALITY_USER; 
GRANT USAGE ON DATABASE my_database TO ROLE COMMONALITY_READ; 
GRANT USAGE ON WAREHOUSE my_warehouse TO ROLE COMMONALITY_READ; 
GRANT USAGE ON SCHEMA public TO COMMONALITY_READ; 
GRANT SELECT ON ALL TABLES IN SCHEMA public TO COMMONALITY_READ;

Make sure that "All Queries" is checked to ensure that all 5 statements are executed.

Click on "Run" and you should see "Statement executed successfully." printed out to the console. If you encounter an error, ensure that the database and warehouse that you are attempting to change permissions for is selected in the dropdown in the top right corner of the worksheet.

4. Enter your credentials in Commonality

We're all done on the Snowflake side of things, now it's time to hook everything up and connect Commonality to your Snowflake instance.

Enter your account name, this may include identifiers like "us-east-1" or ".aws" based on what cloud provider your snowflake instance is using or where it is hosted. You can easily find your account name by looking at the URL of your snowflake instance.

Enter the database name that you'd like to connect to, this will correspond to the database that you granted permissions to in the previous step. If you did not set a default warehouse for your new user you'll also need to enter the name of the warehouse that you granted permissions to as well.

Lastly, enter the username and password for the user that you created and click "Create".

Troubleshooting

I'm receiving the error "Cannot perform SELECT. This session does not have a current database. Call 'USE DATABASE', or use a qualified name."

  • This may be due to the fact that your user was not set to "ACCOUNTADMIN" when creating your new user and role for Commonality. Try re-creating your user with this account setting.
  • You also may not have had "All Queries" checked when executing the SQL that granted your new role permissions to access the database. Try re-running the SQL snippet in step three.