snowflake-cli
БесплатноБез исполняемых скриптовНе проверенExecuting SQL, managing Snowflake objects, deploying applications, and orchestrating data pipelines using the Snowflake CLI (snow) command. Use this skill…
Об этом скилле
Snowflake CLI (snow)
Execute SQL, manage Snowflake objects, and deploy applications using the Snowflake CLI command-line tool.
When to Use This Skill
Activate this skill when users ask about:
- Running SQL queries and scripts from command line
- Deploying Streamlit applications to Snowflake
- Managing Snowflake stages (upload/download/execute files)
- Using variables and templating in SQL scripts
- Executing Snowpark procedures and Python scripts
- Managing database objects (warehouses, tables, etc.)
- Automating Snowflake operations in CI/CD pipelines
- Multi-environment deployments with variables
- Troubleshooting CLI connection or execution issues
Quick Start
Three Main Use Cases:
- SQL Execution - Run queries and scripts with variable substitution
- Deployments - Deploy Streamlit apps and Snowpark objects
- Stage Operations - Manage files and execute scripts from stages
Connection Behavior
Important: The Snowflake CLI uses the default connection profile from
~/.snowflake/connections.toml unless you specify a different connection with the -c or
--connection flag.
# Uses 'default' connection (implicit)
snow sql -q "SELECT CURRENT_USER()"
# Uses 'default' connection (explicit)
snow sql -q "SELECT CURRENT_USER()" -c default
# Uses specific named connection
snow sql -q "SELECT CURRENT_USER()" -c prod
For connection configuration, see the snowflake-connections skill.
SQL Execution
# Inline query
snow sql -q "SELECT * FROM my_table" -c default
# Execute file
snow sql -f script.sql -c default
# With variables (Jinja {{ }} or <% %> syntax)
snow sql -q "SELECT * FROM {{db}}.{{schema}}.table" \
-D db=PROD_DB -D schema=SALES -c default
Variables & Templating
Critical Concept: Snowflake CLI supports three different variable syntaxes depending on context.
Three Syntax Types
1. Bash Variables - Shell expansion (for environment control):
DB="PROD_DB"
SCHEMA="SALES"
snow sql -q "SELECT * FROM ${DB}.${SCHEMA}.orders" -c default
Use for: Connection names, file paths, environment selection, shell control flow
2. Standard Syntax <% %> - Default for snow sql commands:
# Single-line query with -q flag
snow sql -q "SELECT * FROM <% db %>.<% schema %>.orders" \
-D db=PROD_DB -D schema=SALES -c default
# Multi-line query with -i flag (reads from stdin)
# The -i flag tells snow sql to read SQL from standard input
# <<EOF creates a here-document that feeds multi-line SQL to stdin
snow sql -i -D db=PROD_DB -D schema=SALES -c default <<EOF
SELECT
order_id,
customer_id,
order_total
FROM <% db %>.<% schema %>.orders
WHERE order_date >= CURRENT_DATE - 7;
EOF
Understanding heredoc (<<EOF):
<<EOF- Start of here-document (ends with matchingEOF)- SQL between the markers is fed to
snow sql -ias standard input - Variables are substituted using
<% %>syntax - Useful for readable multi-line SQL without escaping quotes
- The closing
EOFmust be on its own line with no indentation
Combining bash variables with heredoc for multi-statement scripts:
# Set bash variables for environment and database objects
ENV="prod"
CONNECTION="${ENV}_connection"
DB="PROD_DB"
SCHEMA="SALES"
TABLE="orders"
# Heredoc enables multiple SQL statements and complex scripts
# without worrying about quote escaping or line continuations
# Bash expands ${variables} before sending to Snowflake
snow sql -i -c ${CONNECTION} <<EOF
-- Create or replace view
CREATE OR REPLACE VIEW ${DB}.${SCHEMA}.recent_${TABLE} AS
SELECT
order_id,
customer_id,
order_total,
order_date,
'${ENV}' as environment
FROM ${DB}.${SCHEMA}.${TABLE}
WHERE order_date >= CURRENT_DATE - 7;
-- Grant permissions
GRANT SELECT ON VIEW ${DB}.${SCHEMA}.recent_${TABLE} TO ROLE ANALYST;
-- Verify row count
SELECT
COUNT(*) as row_count,
MIN(order_date) as earliest_date,
MAX(order_date) as latest_date
FROM ${DB}.${SCHEMA}.recent_${TABLE};
EOF
Why use heredoc:
- ✅ Multiple SQL statements in one execution
- ✅ No quote escaping needed for complex SQL
- ✅ Readable multi-line scripts with comments
- ✅ Bash expands
${VAR}before sending to Snowflake - ✅ Natural formatting for longer migration or deployment scripts
When to use bash vs Snowflake CLI variables:
- Bash
${VAR}- Simple, expanded before execution (use for most cases) - Snowflake CLI
<% var %>- Use with-Dflags when you need Snowflake CLI to handle substitution (safer for user input)
Use for: Inline SQL and heredoc with snow sql -q or snow sql -i
3. Jinja Syntax {{ }} - Automatic for staged SQL files:
# SQL files on stage use Jinja automatically (no flag needed)
snow stage execute @my_stage/script.sql -c default \
-D db=PROD_DB \
-D schema=SALES
Use for: SQL files executed from stages with snow stage execute
Template Syntax Control
Control which syntaxes are enab
Установить snowflake-cli в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл snowflake-cli?
Executing SQL, managing Snowflake objects, deploying applications, and orchestrating data pipelines using the Snowflake CLI (snow) command. Use this skill when you need to run SQL scripts, deploy Streamlit apps, execute Snowpark procedures, manage stages, automate Snowflake operations from CI/CD pipelines, or work with variables and templating.
Как установить скилл snowflake-cli?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл snowflake-cli запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic