UI and SnowSQL Hands on Lab
Create Objects in the UI
1. Login to the UI: https://au_demo8.ap-southeast-2.snowflakecomputing.com/
2. Create a database named <<USERNAME>>_DB
3. Create a schema in the above database named school
4. Create a table in the above database and schema named <<USERNAME>>_TB with
the following fields and data types:
ID NUMBER(38,0)
NAME CHAR(10)
COUNTRY VARCHAR(20)
ORDERDATE DATE
Download and Install SnowSQL
1. In the UI, web interface, go to Help → Download... to display the Downloads
dialog.
2. Download the SnowSQL client:
3. Install on your machine.
Configure the SnowSQL Driver (OR, go to step 3)
1. Find where SnowSQL has been installed on your machine.
a. Mac: ~/.snowsql/ or /Applications
b. Windows: %USERPROFILE%\.snowsql\
2. Open the config file, and add your connection information underneath a
[connections.training] entry
accountname = training
username = <<your username>>
password = TrainMe1
dbname = <<your username>>_DB
schemaname = school
warehousename = <<your username>>_WH
For Example:
3. You can skip step 1 and 2 and do the following inside your terminal/CMD
snowsql -a au_demo8.ap-southeast-2
Enter User: XXX
Enter Pass: XXX
USE DATABASE <<USERNAME>>_DB;
USE SCHEMA SCHOOL;
Connect to Snowflake Using SnowSQL
1. In a Terminal, start SnowSQL interactively on named connection [training].
2. Create a warehouse called <<USERNAME>>_WH with the following settings:
WAREHOUSE_SIZE = 'XSMALL'
WAREHOUSE_TYPE = 'STANDARD'
AUTO_SUSPEND = 600
AUTO_RESUME = TRUE
MIN_CLUSTER_COUNT = 1
MAX_CLUSTER_COUNT = 1
SCALING_POLICY = 'STANDARD'
COMMENT = 'Level 2 Chicago';
3. Insert the following 3 rows into the table.
2, 'A','UK', '11/02/2005'
4, 'C','SP', '11/02/2005'
3, 'C','DE', '11/02/2005'
4. Query the data in <<USERNAME>>_TB;
5. Download the following .sql file and place in your base user folder. http://bit.ly/2C3uITc
6. Execute the above SQL statement via SnowSQL. Note: you will need to qualify the file
location for this script to run correctly.
snowsql -c training -f demo_table.sql -o header=true -o
output_file=mytest.out
7. Query the data in DEMO_TABLE
Appendix
Create Database
Create Table
Connect to Snowflake Using SnowSQL
snowsql -c training;
CREATE WAREHOUSE <<USERNAME>>_WH WITH WAREHOUSE_SIZE = 'XSMALL' WAREHOUSE_TYPE
= 'STANDARD' AUTO_SUSPEND = 600 AUTO_RESUME = TRUE MIN_CLUSTER_COUNT = 1
MAX_CLUSTER_COUNT = 1 SCALING_POLICY = 'STANDARD' COMMENT = 'Training
Singapore';
INSERT INTO <<USERNAME>>_TB VALUES(2, 'A','UK', '11/02/2005');
INSERT INTO <<USERNAME>>_TB VALUES(4, 'C','SP', '11/02/2005');
INSERT INTO <<USERNAME>>_TB VALUES(3, 'C','DE', '11/02/2005');
SELECT ID, NAME, COUNTRY FROM <<USERNAME>>_TB ORDER BY ID;
SELECT ID, NAME, COUNTRY FROM DEMO_TABLE ORDER BY ID;