0
0
Snowflakecloud~5 mins

What is Snowflake - CLI Guide

Choose your learning style9 modes available
Introduction
Snowflake is a cloud data platform that helps you store and analyze large amounts of data easily. It solves the problem of managing data by separating storage and computing, so you can work faster and pay only for what you use.
When you want to store big data without managing hardware or software.
When you need to run fast queries on your data for reports or analysis.
When you want to share data securely with other teams or partners.
When you want to scale your data storage and computing power independently.
When you want to avoid complex setup and maintenance of traditional databases.
Commands
This command connects you to your Snowflake account using the SnowSQL command-line tool. You need to log in before running any queries or commands.
Terminal
snowsql -a myaccount -u myuser
Expected OutputExpected
Welcome to SnowSQL! You are now connected to Snowflake as user 'myuser' on account 'myaccount'.
-a - Specifies the Snowflake account to connect to.
-u - Specifies the username for login.
This command lists all the compute warehouses available in your Snowflake account. Warehouses are where your queries run.
Terminal
SHOW WAREHOUSES;
Expected OutputExpected
name | state | size | type | ... -----------|--------|--------|----------|--- COMPUTE_WH | ACTIVE | XSMALL | STANDARD | ...
This command creates a new warehouse named 'my_warehouse' with a small size. It will automatically pause after 60 seconds of inactivity and resume when needed, saving costs.
Terminal
CREATE WAREHOUSE my_warehouse WITH WAREHOUSE_SIZE = 'XSMALL' AUTO_SUSPEND = 60 AUTO_RESUME = TRUE;
Expected OutputExpected
Warehouse 'my_warehouse' created successfully.
This command sets 'my_warehouse' as the active warehouse for running queries.
Terminal
USE WAREHOUSE my_warehouse;
Expected OutputExpected
Using warehouse 'my_warehouse'.
This command shows the current version of Snowflake you are connected to.
Terminal
SELECT CURRENT_VERSION();
Expected OutputExpected
CURRENT_VERSION() ----------------- 6.40.0
Key Concept

If you remember nothing else from Snowflake, remember: it separates storage and computing so you can scale and pay for each independently.

Common Mistakes
Trying to run queries without selecting a warehouse first.
Queries need a warehouse to run; without selecting one, Snowflake will return an error.
Always run 'USE WAREHOUSE warehouse_name;' before running queries.
Creating warehouses without auto-suspend enabled.
Warehouses keep running and cost money even when not in use.
Set AUTO_SUSPEND to a reasonable time to save costs when idle.
Summary
Connect to Snowflake using SnowSQL with your account and username.
List and create warehouses to run your queries.
Set an active warehouse before running queries.
Snowflake separates storage and compute for flexible scaling and cost control.