Snowflake Document
Snowflake Document
Snowflake Document
Roles in Snowflake:
1.AccountAdmin
2.OrgAdmin
3.Public
4.Securityadmin
5.Sysadmin
6.Useradmin
Creating Warehouse:
Creating Tables:
Creating Objects:
--Caden set up a new database (and you will, too)
create database ACME;
use database ACME;
--get rid of the public schema - too generic
drop schema ACME.PUBLIC;
Creating Stage:
create stage util_db.public.like_a_window_into_an_s3_bucket
url = 's3://uni-lab-files';
Creating few more objects to load data :
--Max has Lottie's VINventory table. Now he'll join his decode tables to the data
-- He'll create a select statement that ties each table into Lottie's VINS
-- Every time he adds a new table, he'll make sure he still has 298 rows
SELECT *
FROM ACME_DETROIT.ADU.LOTSTOCK l-- he uses Lottie's data from the INBOUND SHARE
JOIN MAX_VIN.DECODE.MODELYEAR y -- and confirms he can join it with his own decode
data
ON l.modyearcode=y.modyearcode;
SELECT *
FROM ACME_DETROIT.ADU.LOTSTOCK l -- he uses Lottie's data from the INBOUND SHARE
JOIN MAX_VIN.DECODE.WMITOMANUF w -- and confirms he can join it with his own
decode data
ON l.WMI=w.WMI;
--Look at the task you just created to make sure it turned out okay
show tasks;
desc task acme_return_update;
--if you task has a state of "suspended" run this to get it going
alter task acme_return_update resume;
--Check back 5 mins later to make sure your task has been running
--You will not be able to see your task on the Query History Tab
select *
from table(information_schema.task_history())
order by scheduled_time;
show tasks in account;
desc task acme_return_update;
--Check back 5 mins later to make sure your task is NOT running
desc task acme_return_update;
select *
from MAX_OUTGOING.FOR_ACME.LOTSTOCKRETURN
Inbound Shares:
-- Regions Table
SELECT R_REGIONKEY, R_NAME
FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.REGION;