본문으로 건너뛰기
Skillpedia
데이터베이스29k · #9523

snowflake-development

하는 일

이 스킬은 에이전트에게 실용적인 Snowflake SQL과 데이터 파이프라인 패턴을 제공합니다. Dynamic Tables, Streams, Tasks, Snowpark Python, Cortex AI를 다루며, Snowflake 데이터 플랫폼에서 작업을 만들거나 고치는 데이터 엔지니어와 분석가를 위한 스킬입니다.

사용하는 경우

  • ✓Snowflake 데이터에 MERGE 업서트나 Dynamic Table이 필요할 때.
  • ✓Snowflake 쿼리가 느리거나 이해할 수 없는 오류가 날 때.
  • ✓쿼리 안에서 Snowflake Cortex AI 함수를 쓰고 싶을 때.

스킬 링크

https://github.com/alirezarezvani/claude-skills/blob/main/engineering-team/snowflake-development/skills/snowflake-development/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/alirezarezvani/claude-skills/blob/main/engineering-team/snowflake-development/skills/snowflake-development/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“스테이징 테이블의 새 고객 행을 customers 테이블에 업서트하는 Snowflake MERGE를 작성해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 명시적인 열 목록과 CTE처럼 Snowflake 모범 사례를 따르는 SQL을 쓰며, MERGE, Dynamic Table, 역할 권한 부여를 위한 템플릿을 생성할 수 있습니다. Snowpark Python 코드도 도울 수 있습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Snowflake Development

Snowflake SQL, data pipelines, Cortex AI, and Snowpark Python development. Covers the colon-prefix rule, semi-structured data, MERGE upserts, Dynamic Tables, Streams+Tasks, Cortex AI functions, agent specs, performance tuning, and security hardening.

Originally contributed by James Cha-Earley — enhanced and integrated by the claude-skills team.

Quick Start

# Generate a MERGE upsert template
python scripts/snowflake_query_helper.py merge --target customers --source staging_customers --key customer_id --columns name,email,updated_at

# Generate a Dynamic Table template
python scripts/snowflake_query_helper.py dynamic-table --name cleaned_events --warehouse transform_wh --lag "5 minutes"

# Generate RBAC grant statements
python scripts/snowflake_query_helper.py grant --role analyst_role --database analytics --schemas public,staging --privileges SELECT,USAGE

SQL Best Practices

Naming and Style

  • Use snake_case for all identifiers. Avoid double-quoted identifiers -- they force case-sensitive names that require constant quoting.
  • Use CTEs (WITH clauses) over nested subqueries.
  • Use CREATE OR REPLACE for idempotent DDL.
  • Use explicit column lists -- never SELECT * in production. Snowflake's columnar storage scans only referenced columns, so explicit lists reduce I/O.

Stored Procedures -- Colon Prefix Rule

In SQL stored procedures (BEGIN...END blocks), variables and parameters must use the colon : prefix inside SQL statements. Without it, Snowflake treats them as column identifiers and raises "invalid identifier" errors.

-- WRONG: missing colon prefix
SELECT name INTO result FROM users WHERE id = p_id;

-- CORRECT: colon prefix on both variable and parameter
SELECT name INTO :result FROM users WHERE id = :p_id;

This applies to DECLARE variables, LET variables, and procedure parameters when used inside SELECT, INSERT, UPDATE, DELETE, or MERGE.

Semi-Structured Data

  • VARIANT, OBJECT, ARRAY for JSON/Avro/Parquet/ORC.
  • Access nested fields: src:customer.name::STRING. Always cast with ::TYPE.
  • VARIANT null vs SQL NULL: JSON null is stored as the string "null". Use STRIP_NULL_VALUE = TRUE on load.
  • Flatten arrays: SELECT f.value:name::STRING FROM my_table, LATERAL FLATTEN(input => src:items) f;

MERGE for Upserts

MERGE INTO target t USING source s ON t.id = s.id
WHEN MATCHED THEN UPDATE SET t.name = s.name, t.updated_at = CURRENT_TIMESTAMP()
WHEN NOT MATCHED THEN INSERT (id, name, updated_at) VALUES (s.id, s.name, CURRENT_TIMESTAMP());

See references/snowflake_sql_and_pipelines.md for deeper SQL patterns and anti-patterns.


Data Pipelines

Choosing Your Approach

Approach When to Use
Dynamic Tables Declarative transformations. Default choice. Define the query, Snowflake handles refresh.
Streams + Tasks Imperative CDC. Use for procedural logic, stored procedure calls, complex branching.
Snowpipe Continuous file loading from cloud storage (S3, GCS, Azure).

Dynamic Tables

CREATE OR REPLACE DYNAMIC TABLE cleaned_events
    TARGET_LAG = '5 minutes'
    WAREHOUSE = transform_wh
    AS
    SELECT event_id, event_type, user_id, event_timestamp
    FROM raw_events
    WHERE event_type IS NOT NULL;

Key rules:

  • Set TARGET_LAG progressively: tighter at the top of the DAG, looser downstream.
  • Incremental DTs cannot depend on Full-refresh DTs.
  • SELECT * breaks on upstream schema changes -- use explicit column lists.
  • Views cannot sit between two Dynamic Tables in the DAG.

Streams and Tasks

CREATE OR REPLACE STREAM raw_stream ON TABLE raw_events;

CREATE OR REPLACE TASK process_events
    WAREHOUSE = transform_wh
    SCHEDULE = 'USING CRON 0 */1 * * * America/Los_Angeles'
    WHEN SYSTEM$STREAM_HAS_DATA('raw_stream')
    AS INSERT INTO cleaned_events SELECT ... FROM raw_stream;

-- Tasks start SUSPENDED. You MUST resume them.
ALTER TASK process_events RESUME;

See references/snowflake_sql_and_pipelines.md for DT debugging queries and Snowpipe patterns.


Cortex AI

Function Reference

Function Purpose
AI_COMPLETE LLM completion (text, images, documents)
AI_CLASSIFY Classify text into categories (up to 500 labels)
AI_FILTER Boolean filter on text or images
AI_EXTRACT Structured extraction from
자주 묻는 질문

준비된 SQL 템플릿을 만들어 주나요?

네. 도우미 스크립트가 MERGE 업서트, Dynamic Table, 접근 권한 부여 문의 템플릿을 만듭니다.

Snowflake의 AI 기능도 다루나요?

네. Cortex AI 함수와 에이전트 스펙을 다룹니다.

어떤 SQL 스타일을 권하나요?

snake_case 이름, CTE, 운영 환경에서는 SELECT * 대신 명시적인 열 목록을 권합니다.

상세 정보

작성자의 원본 설명

Use for Snowflake work: SQL, Dynamic Tables, Streams and Tasks, Cortex AI functions and agents, Snowpark Python, dbt on Snowflake, or Snowflake errors. Helps with queries via snowflake_query_helper.py.

repo: alirezarezvani/claude-skills

인기도

GitHub 스타
29k
순위
#9523
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬