Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Customer Instructions for Snowflake Data Sharing

  • Create a snowflake account. The account must be in the Amazon (AWS) cloud, and must be in the us-west-2 (oregon) region.

  • Create an "account admin" user/password for the snowflake account. Do not share this password with Call Potential or any other tool. This is the master account password and should stay secret.

  • Log in to the web console after the account is provisioned, which takes a few minutes.

  • Send Call Potential the account web URL. It looks like this: https://XXXXXXX.snowflakecomputing.com/

  • Call Potential will respond when the data is shared with your account ID.

  • Click on the "Shares" tab, and click on "Inbound". You should see an "EXPORTS" share from QAA98122 (Call Potential): 

  • Click on the "Worksheets" tab, and paste the script below. Change the CALLPOTENTIAL password (on the last line) to your choice. Make sure the "All Queries" checkbox is checked, then click "Run".

USE ROLE ACCOUNTADMIN;

CREATE ROLE IF NOT EXISTS CALLPOTENTIAL_ROLE;
GRANT ROLE CALLPOTENTIAL_ROLE TO ROLE SYSADMIN;

-- Create a warehouse
CREATE WAREHOUSE IF NOT EXISTS CALLPOTENTIAL_WAREHOUSE WITH WAREHOUSE_SIZE = XSMALL
    AUTO_SUSPEND = 60
    AUTO_RESUME = TRUE
    INITIALLY_SUSPENDED = FALSE;
GRANT USAGE ON WAREHOUSE CALLPOTENTIAL_WAREHOUSE TO ROLE CALLPOTENTIAL_ROLE;
GRANT OPERATE ON WAREHOUSE CALLPOTENTIAL_WAREHOUSE TO ROLE CALLPOTENTIAL_ROLE;
GRANT MONITOR ON WAREHOUSE CALLPOTENTIAL_WAREHOUSE TO ROLE CALLPOTENTIAL_ROLE;

-- Create a non-administrator user that has read-only access to the data
-- This user should be used by scripts that dump data to .csv, for example.
CREATE USER IF NOT EXISTS CALLPOTENTIAL WITH DEFAULT_ROLE = CALLPOTENTIAL_ROLE
    DEFAULT_WAREHOUSE = CALLPOTENTIAL_WAREHOUSE;
GRANT ROLE CALLPOTENTIAL_ROLE TO USER CALLPOTENTIAL;

-- Create the shared database
CREATE DATABASE IF NOT EXISTS "CALLPOTENTIAL" FROM SHARE QAA98122."EXPORTS" COMMENT='Shared data from Call Potential';
GRANT IMPORTED PRIVILEGES ON DATABASE "CALLPOTENTIAL" TO ROLE "CALLPOTENTIAL_ROLE";

-- Set the password to your choice.  You can run this command again to change it.
ALTER USER CALLPOTENTIAL SET PASSWORD = 'MyPassword12345!';

  • The CALLPOTENTIAL database should be visible in the 'Databases" tab of the web console. It doesn't have any tables, but it does have many views.

  • Click on the "Worksheets" tab of the web console and start a fresh (empty) worksheet. Ensure the correct warehouse (CALLPOTENTIAL_WAREHOUSE), database (CALLPOTENTIAL), role (CALLPOTENTIAL_ROLE), and schema (EXPORTS) are selected in the upper right. Then run a query, such as "SELECT * FROM leads ORDER BY contact_date DESC;" 

  • The CALLPOTENTIAL user can be used by other Business Intelligence tools to query the snowflake data directly. It is highly recommended to use the CALLPOTENTIAL user, and not the account admin, since the CALLPOTENTIAL user can't modify or delete objects in your account.

  • The snowsql command can be used by CLI scripts. See https://docs.snowflake.com/en/user-guide/snowsql-install-config.html for details on installing it. After it is installed, you can dump data to .csv, for example:

snowsql -o output_format=csv -q "select * from leads ..." > leads.csv

  • No labels