Getting Started with Snowflake (Create Snowflake Objects)

337 viewsNative Apps Frameworksnowflakenativeapps
0

Getting Started with Snowflake (Create Snowflake Objects):

Alejandro Penzini Answered question December 13, 2023
0

In this phase, you will craft the subsequent Snowflake objects:

Database and Table Creation:

Establish a database (sf_tuts) and a table (emp_basic) for loading sample data.
Develop a virtual warehouse (sf_tuts_wh) with X-Small capacity, facilitating data loading and table querying. This specific warehouse is designed for the tutorial.
Upon tutorial completion, these objects will be removed.

Create a Database:
Use the CREATE DATABASE command to generate the sf_tuts database:

CREATE OR REPLACE DATABASE sf_tuts;

For this tutorial, utilize the default schema (public) available for each database instead of creating a new schema.

Verify the active database and schema for your current session using the context functions:

SELECT CURRENT_DATABASE(), CURRENT_SCHEMA();

An example result may resemble:

+--------------------+------------------+
| CURRENT_DATABASE() | CURRENT_SCHEMA() |
|--------------------+------------------|
| SF_TUTS | PUBLIC |
+--------------------+------------------+

Create a Table:
Generate a table named emp_basic within sf_tuts.public using the CREATE TABLE command. The table structure corresponds to the fields in the forthcoming CSV data files:

CREATE OR REPLACE TABLE emp_basic (
first_name STRING,
last_name STRING,
email STRING,
streetaddress STRING,
city STRING,
start_date DATE
);

Create a Virtual Warehouse:
Form an X-Small warehouse called sf_tuts_wh using the CREATE WAREHOUSE command. This warehouse is initially suspended but is configured to automatically resume when SQL statements requiring compute resources are executed:

CREATE OR REPLACE WAREHOUSE sf_tuts_wh WITH
WAREHOUSE_SIZE='X-SMALL'
AUTO_SUSPEND = 180
AUTO_RESUME = TRUE
INITIALLY_SUSPENDED=TRUE;

Verify the active warehouse for your current session:

SELECT CURRENT_WAREHOUSE();

An example result may appear as:

+---------------------+
| CURRENT_WAREHOUSE() |
|---------------------|
| SF_TUTS_WH |
+---------------------+

Alejandro Penzini Answered question December 13, 2023
You are viewing 1 out of 1 answers, click here to view all answers.
Feedback on Q&A