Prerequisites
A Snowflake account. Sign up for a free trial on Snowflake’s website.
ACCOUNTADMIN
role privileges in Snowflake, OR privileges equivalent to theSECURITYADMIN
andSYSADMIN
roles. More info on Snowflake’s user roles can be found here.Familiarity with Snowflake’s SQL Worksheet feature OR access to to a SQL client. This tutorial will use the SQL Worksheet in the Snowflake web app to run SQL commands.
Step 1: Create a Snowflake data warehouse
- Log into your Snowflake account using a web browser or a SQL client.
- If you log in via a web browser, click the Worksheet icon at the top of the page.
-
Create the warehouse by running this command, changing the values in the brackets (
<>
) to the values you want:CREATE WAREHOUSE <stitch_warehouse> WITH AUTO_RESUME = TRUE WAREHOUSE_SIZE = <size> AUTO_SUSPEND = <time_in_seconds>;
Check out Snowflake’s documentation for more info on these parameters.
The parameters in this command define the following:
- AUTO_RESUME: If
TRUE
, the warehouse will be automatically resumed when accessed by a SQL statement. IfFALSE
, the warehouse will only start again when explicitly resumed through the Snowflake web interface or usingALTER WAREHOUSE
. -
WAREHOUSE_SIZE: Specifies the size of the warehouse to create. Accepted values are
XSMALL
,SMALL
,MEDIUM
,LARGE
,XLARGE
,XXLARGE
,XXXXLARGE
, andXXXXLARGE
.The default is
XSMALL
. - AUTO_SUSPEND: Specifies the number of seconds of inactivity after which a warehouse is automatically suspended.
- AUTO_RESUME: If
Important: Make sure Auto-Suspend is enabled!
Make sure the AUTO_SUSPEND
parameter is included in the warehouse creation command. This parameter determines how many seconds of inactivity must pass before a warehouse is automatically suspended.
If this parameter isn’t included, the default will be NULL
, meaning that the warehouse will never automatically suspend. As a result, Snowflake credits will continue to be consumed even if the warehouse is inactive.
Step 2: Create a Stitch database and database user
Next, you’ll create a database and database user for Stitch.
Step 2.1: Create the database
Create the database for Stitch, changing <stitch_database>
to what you want the database to be named:
CREATE DATABASE <stitch_database>;
Step 2.2: Create the database user
-
Create a role for the Stitch user:
-
Optional: If you’ve created a hierarchy that assigns all custom roles to the
SYSADMIN
role, grant the<stitch_role>
to theSYSADMIN
role: -
Grant warehouse privileges to the Stitch role, using the name of the warehouse you created for Stitch.
Note: This will grant all privileges except
OWNERSHIP
, and only apply to the warehouse you specify. -
Grant database privileges to the Stitch role, using the name of the database you created for Stitch.
Note: This will grant all privileges except
OWNERSHIP
, and only apply to the database(s) you specify. -
Create the Stitch user and grant the Stitch role to the user:
In the table below are the database user privileges Stitch requires to connect to and load data into Snowflake.
Privilege name | Reason for requirement |
GRANT ALL ON WAREHOUSE |
Required to connect to the warehouse and change the state of the warehouse (start, resume), which is necessary to load data. |
GRANT ALL ON DATABASE |
Required to create the necessary database objects to load and store your data. |
Step 3: Configure network access settings
In Snowflake, access is configured and managed through Network Security Policies. Stitch’s IP addresses must be added to a network policy’s Allowed IP List for the connection to be successful.
Step 3.1: Verify your Stitch account's data pipeline region
First, you’ll log into Stitch and verify the data pipeline region your account is using.
The IP addresses you’ll whitelist depend on the Data pipeline region your account is in.
- Sign into your Stitch account, if you haven’t already.
- Click User menu (your icon) > Edit User Settings and locate the Data pipeline region section to verify your account’s region.
-
Locate the list of IP addresses for your region:
Keep this list handy - you’ll need it in the next step.
Step 3.2: Create and apply the network policy
In this step, you’ll create the network policy, add Stitch’s IP addresses, and apply it to the account.
-
Run the following command to create the policy and add Stitch’s IP addresses.
In the command, replace:
<stitch_policy>
with a name for the policy<your-current-ip-address>
with the IP address your current computer<comma-delimited-stitch-ip-addresses>
with a comma-delimited list of the IP addresses you retrieved in the previous step
CREATE NETWORK POLICY <stitch_policy> ALLOWED_IP_LIST = ('<your-current-ip-address>','<comma-delimited-stitch-ip-addresses>');
-
Run the following command to apply the network policy to the account, replacing
<stitch_policy>
with the name of the policy from the previous step.Note Your current IP address must be included in the Allowed IP List to run this command successfully:
ALTER ACCOUNT SET NETWORK_POLICY = <stitch_policy>;
If you encounter an error, ensure that your current IP address is in the Allowed IP List and try again. Contact Snowflake support if errors persist.
Step 4: Connect Stitch
To complete the setup, you need to enter your Snowflake connection details into the Destination Settings page in Stitch.
Step 4.1: Enter connection details into Stitch
- If you aren’t signed into your Stitch account, sign in now.
-
Click the Destination tab.
- Locate and click the Snowflake icon.
-
Fill in the fields as follows:
-
Display Name: Enter a display name for your destination, to distinguish various connections of the same type.
-
Description (optional): Enter a description for your destination.
-
Host (Endpoint): Enter the URL of your Snowflake account. For example:
stitch.snowflakecomputing.com
. Note: Entering thehttp://
orhttps://
portion of the URL will prevent a successful connection. -
Username: Enter the Stitch Snowflake database user’s username.
-
Password: Enter the password for the Stitch Snowflake database user.
-
**: Enter the name of the database you created for Stitch in Step 2.1.
-
Warehouse: Enter the name of the Snowflake warehouse that you created for Stitch in Step 1.
-
Role: Optional: Enter the name of the role the Stitch database user should use.
-
Step 4.2: Save the destination
When finished, click Check and Save.
Stitch will perform a connection test to the Snowflake database; if successful, a Success! message will display at the top of the screen. Note: This test may take a few minutes to complete.
Related | Troubleshooting |
Questions? Feedback?
Did this article help? If you have questions or feedback, feel free to submit a pull request with your suggestions, open an issue on GitHub, or reach out to us.