05 Jan 19 ·  nVector in Snowflake ·        Bookmark ·  Report ·  More actions.. Lock comments ·  Pin thread

Setup the environment in Snowflake


We will create the virtual warehouse, database, and the schema. The SQL commands used in the lesson are given below. Just click on the code snippet once to copy to clipboard.

Creating a Virtual Warehouse:

CREATE WAREHOUSE TRAINING_WH
WITH
WAREHOUSE_SIZE = XSMALL
AUTO_SUSPEND = 60
AUTO_RESUME = TRUE
INITIALLY_SUSPENDED = TRUE
STATEMENT_QUEUED_TIMEOUT_IN_SECONDS = 300
STATEMENT_TIMEOUT_IN_SECONDS = 600;

Creating a Database (Remember to substitute your username):

CREATE DATABASE SALES_{USERNAME}_DB
DATA_RETENTION_TIME_IN_DAYS = 0
COMMENT = 'Ecommerce sales info';

Creating multiple Schemas:

create schema Sales_Data;
create schema Sales_Views;
create schema Sales_Stage;

Setting Context:

USE WAREHOUSE TRAINING_WH;
USE DATABASE SALES_{USERNAME}_DB;
USE SCHEMA Sales_Data;

Finding the context:

select CURRENT_DATABASE(), CURRENT_SCHEMA(), CURRENT_WAREHOUSE();