Links

Snowflake

Connect & Ingest data from / to a Snowflake database

Sling CLI Setup

The following credentials keys are accepted:
  • host (required) -> The hostname or account the instance (eg. pua90768.us-east-11)
  • user (required) -> The username to access the instance
  • database (required) -> The database name of the instance
  • password (required) -> The password to access the instance
  • schema (optional) -> The default schema to use
  • role (optional) -> The role to access the instance
  • warehouse (optional) -> The warehouse to use
  • passcode (optional) -> Specifies the passcode provided by Duo when using multi-factor authentication (MFA) for login.
  • authenticator (optional) -> Specifies the authenticator to use to login.
Here is an example of setting a connection named SNOWFLAKE. We must provide the type=snowflake property:
$ sling conns set SNOWFLAKE type=snowflake host=<host> user=<user> database=<database> password=<password> role=<role>
# Or use url
$ sling conns set SNOWFLAKE url=snowflake://myuser:[email protected]/mydatabase?schema=<schema>&role=<role>

Environment Variable

export SNOWFLAKE='snowflake://myuser:[email protected]/mydatabase?schema=<schema>&role=<role>'

Sling Cloud Setup

  • In Sling Cloud, click the Connections link on the left sidebar.
  • On top, click New Connection.
  • Search for "Snowflake". Click on it.
  • Input the needed information.
  • Click Test to verify connectivity.
  • Click Save to save the connection.

Database user creation

To allow Sling to access your database, we need to create a user with the proper privileges. Please follow the steps below:
  1. 1.
    Create a user sling (or whatever you prefer) by running:
    -- Need a Role for Sling user
    CREATE ROLE SLING_ROLE COMMENT = 'Role for Sling';
    GRANT ROLE SLING_ROLE to role SYSADMIN;
    -- Need a warehouse for Sling user
    CREATE WAREHOUSE SLING_WAREHOUSE
    WITH
    INITIALLY_SUSPENDED = TRUE
    AUTO_RESUME = TRUE
    WAREHOUSE_SIZE = xsmall
    WAREHOUSE_TYPE = STANDARD
    AUTO_SUSPEND = 60;
    GRANT ALL ON WAREHOUSE SLING_WAREHOUSE TO ROLE SLING_ROLE;
    CREATE USER sling
    PASSWORD='<password>'
    COMMENT='User for Sling'
    DEFAULT_ROLE='SLING_ROLE'
    DEFAULT_WAREHOUSE='SLING_WAREHOUSE';
    GRANT ROLE SLING_ROLE to user SLING;
  2. 2.
    If you are planning to load data into this connection, grant the following privileges to that user:
    CREATE DATABASE SLING; -- or some other database
    GRANT ALL ON DATABASE SLING TO ROLE SLING_ROLE;
    USE DATABASE SLING;
    GRANT ALL ON SCHEMA PUBLIC TO SLING_ROLE;
  3. 3.
    If you are planning to extract data from this connection, you need to give permission to read the tables you'd like Sling to extract.
    -- Need this to read table & column names
    GRANT SELECT ON SCHEMA <schema_name> TO SLING_ROLE;
    -- run this to grant SELECT permission to all tables in database `marketing` to role sling
    GRANT SELECT ON DATABASE marketing TO ROLE SLING_ROLE;

IP Address Whitelisting

If your database instance is secured behind a cloud firewall, please whitelist the IP addresses listed here. We may not be able to establish a connection without this step.
If you are facing issues connecting, please reach out to us at [email protected].