Tutorial

The Snowflake Command Cheat Sheet Every Data Engineer Should Bookmark

August 23, 2026
42 views

The SQL and SnowSQL commands that come up constantly once you're running a real Snowflake environment — warehouses, RBAC, loading, and monitoring.

Warehouse Management

SQL
-- Create a warehouse
CREATE WAREHOUSE etl_wh
  WAREHOUSE_SIZE = 'MEDIUM'
  AUTO_SUSPEND = 60
  AUTO_RESUME = TRUE
  INITIALLY_SUSPENDED = TRUE;

-- Resize on the fly
ALTER WAREHOUSE etl_wh SET WAREHOUSE_SIZE = 'LARGE';

-- Multi-cluster warehouse for concurrency
ALTER WAREHOUSE reporting_wh SET
  MIN_CLUSTER_COUNT = 1
  MAX_CLUSTER_COUNT = 4
  SCALING_POLICY = 'STANDARD';

-- Check warehouse usage/cost
SELECT warehouse_name, SUM(credits_used) AS credits
FROM snowflake.account_usage.warehouse_metering_history
WHERE start_time >= DATEADD(day, -7, CURRENT_TIMESTAMP())
GROUP BY warehouse_name
ORDER BY credits DESC;

Loading Data

SQL
-- Create a stage pointing to S3
CREATE STAGE my_stage
  URL = 's3://my-bucket/data/'
  CREDENTIALS = (AWS_KEY_ID = '...' AWS_SECRET_KEY = '...')
  FILE_FORMAT = (TYPE = PARQUET);

-- Bulk load via COPY INTO
COPY INTO sales.orders
FROM @my_stage
FILE_FORMAT = (TYPE = PARQUET)
MATCH_BY_COLUMN_NAME = CASE_INSENSITIVE;

-- Snowpipe for continuous ingestion
CREATE PIPE sales.orders_pipe
  AUTO_INGEST = TRUE
AS
COPY INTO sales.orders
FROM @my_stage
FILE_FORMAT = (TYPE = PARQUET);

-- Check pipe status and load history
SELECT SYSTEM$PIPE_STATUS('sales.orders_pipe');
SELECT * FROM TABLE(INFORMATION_SCHEMA.COPY_HISTORY(
  TABLE_NAME => 'ORDERS', START_TIME => DATEADD(hour, -24, CURRENT_TIMESTAMP())
));

Dynamic Tables (Snowflake's declarative pipelines)

SQL
CREATE DYNAMIC TABLE sales.daily_rollup
  TARGET_LAG = '1 hour'
  WAREHOUSE = etl_wh
AS
SELECT order_date, SUM(amount) AS total_amount
FROM sales.orders
GROUP BY order_date;

-- Check refresh history
SELECT * FROM TABLE(INFORMATION_SCHEMA.DYNAMIC_TABLE_REFRESH_HISTORY(
  NAME => 'sales.daily_rollup'
));

Time Travel and Cloning

SQL
-- Query historical data
SELECT * FROM sales.orders AT (OFFSET => -3600);
SELECT * FROM sales.orders BEFORE (STATEMENT => '<query_id>');

-- Zero-copy clone (instant, no storage cost until divergence)
CREATE TABLE sales.orders_dev CLONE sales.orders;
CREATE DATABASE dev_db CLONE prod_db;

-- Undrop a table
UNDROP TABLE sales.orders;

RBAC

SQL
CREATE ROLE analyst_role;
GRANT USAGE ON WAREHOUSE reporting_wh TO ROLE analyst_role;
GRANT SELECT ON ALL TABLES IN SCHEMA sales TO ROLE analyst_role;
GRANT SELECT ON FUTURE TABLES IN SCHEMA sales TO ROLE analyst_role;
GRANT ROLE analyst_role TO USER jsmith;

-- Row access policy
CREATE ROW ACCESS POLICY region_filter AS (region VARCHAR) RETURNS BOOLEAN ->
  CURRENT_ROLE() = 'ADMIN' OR region = CURRENT_ROLE();

ALTER TABLE sales.orders ADD ROW ACCESS POLICY region_filter ON (region);

Query and Performance Diagnostics

SQL
-- Query history with execution time
SELECT query_id, query_text, execution_time, warehouse_name
FROM snowflake.account_usage.query_history
WHERE start_time >= DATEADD(hour, -1, CURRENT_TIMESTAMP())
ORDER BY execution_time DESC
LIMIT 20;

-- Currently running queries
SHOW WAREHOUSES;
SELECT * FROM TABLE(INFORMATION_SCHEMA.QUERY_HISTORY())
WHERE execution_status = 'RUNNING';

-- Kill a running query
SELECT SYSTEM$CANCEL_QUERY('<query_id>');

-- Table clustering info
SELECT SYSTEM$CLUSTERING_INFORMATION('sales.orders', '(order_date)');

SnowSQL CLI

Shell
# Connect
snowsql -a <account> -u <user> -d sales_db -s public

# Run a script
snowsql -c my_connection -f load_script.sql

# Bulk PUT/GET to internal stage
PUT file://local_data.csv @my_stage;
GET @my_stage/local_data.csv file://./downloads/;

Time Travel, zero-copy cloning, and

Code
ACCOUNT_USAGE
views are the three things that separate teams who fight Snowflake from teams who use it the way it's meant to be used.

Tags

snowflake
cheat sheet
sql
reference

Get the latest insights

Subscribe for new articles on cloud architecture, data platforms, and engineering leadership.

ShubhZone Pro

Cloud architecture and fractional CTO services for teams building what's next.

Let's Talk

Strategy sessions, architecture reviews, and advisory engagements.

© 2026 ShubhZone Pro. All rights reserved.