Skip to main content 홈 크리에이터 jeremylongshore claude-code-plugins-plus-skills snowflake-local-dev-loop
snowflake-local-dev-loop Configure Snowflake local development with testing, mocking, and fast iteration.
Use when setting up dev environment, writing tests against Snowflake,
or establishing a fast iteration cycle with SnowSQL and dev warehouses.
Trigger with phrases like "snowflake dev setup", "snowflake local development",
"snowflake dev environment", "develop with snowflake", "snowflake testing".
설치로 이동 Skills Marketplace 커뮤니티가 만든 AI 스킬을 발견하고 탐색하세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skills --skill snowflake-local-dev-loop명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
Zip 다운로드 다운로드 중... name snowflake-local-dev-loop description Configure Snowflake local development with testing, mocking, and fast iteration.
Use when setting up dev environment, writing tests against Snowflake,
or establishing a fast iteration cycle with SnowSQL and dev warehouses.
Trigger with phrases like "snowflake dev setup", "snowflake local development",
"snowflake dev environment", "develop with snowflake", "snowflake testing".
allowed-tools Read, Write, Edit, Bash(npm:*), Bash(pnpm:*), Grep version 1.5.0 license MIT author Jeremy Longshore <jeremy@intentsolutions.io> tags ["saas","data-warehouse","analytics","snowflake"] compatibility Designed for Claude Code
Snowflake Local Dev Loop
Overview
Set up a fast, reproducible local development workflow for Snowflake with separate dev warehouses, mocked tests, and SnowSQL for rapid iteration.
Prerequisites
Completed snowflake-install-auth setup
Node.js 18+ or Python 3.9+
A dedicated dev warehouse (e.g., DEV_WH_XS) with auto-suspend
Instructions
Step 1: Create Dev-Specific Snowflake Objects
CREATE WAREHOUSE IF NOT EXISTS DEV_WH_XS
WAREHOUSE_SIZE = 'XSMALL'
AUTO_SUSPEND = 60
AUTO_RESUME = TRUE
INITIALLY_SUSPENDED = TRUE ;
CREATE DATABASE IF NOT EXISTS DEV_DB;
CREATE SCHEMA IF NOT EXISTS DEV_DB.SANDBOX;
GRANT USAGE ON WAREHOUSE DEV_WH_XS TO ROLE DEV_ROLE;
GRANT ALL ON DATABASE DEV_DB TO ROLE DEV_ROLE;
Step 2: Project Structure
my-snowflake-project/
├── src/
│ ├── snowflake/
│ │ ├── connection.ts # Connection wrapper with connectAsync
│ │ ├── queries.ts # Typed query functions
│ │ └── types.ts # Row type definitions
│ └── index.ts
├── tests/
│ ├── unit/
│ │ └── queries.test.ts # Mocked — no Snowflake needed
│ └── integration/
│ └── snowflake.test.ts # Requires SNOWFLAKE_* env vars
├── sql/
│ ├── migrations/ # Versioned DDL scripts
│ │ ├── V001__create_users.sql
│ │ └── V002__add_orders.sql
│ └── seeds/
│ └── dev-data.sql # Sample data for dev
├── .env.local # Local secrets (git-ignored)
├── .env.example # Template for team
└── package.json
Step 3: Connection Wrapper with Async/Await
import snowflake from 'snowflake-sdk' ;
snowflake.configure ({ logLevel : 'WARN' });
export function createSnowflakeConnection ( ) {
return snowflake.createConnection ({
account : process.env .SNOWFLAKE_ACCOUNT !,
username : process.env .SNOWFLAKE_USER !,
password : process.env .SNOWFLAKE_PASSWORD !,
warehouse : process.env .SNOWFLAKE_WAREHOUSE || 'DEV_WH_XS' ,
database : process.env .SNOWFLAKE_DATABASE || 'DEV_DB' ,
schema : process.env .SNOWFLAKE_SCHEMA || 'SANDBOX' ,
role : process.env .SNOWFLAKE_ROLE || 'DEV_ROLE' ,
});
}
export function executeQuery (
conn : snowflake.Connection ,
sqlText : string ,
binds ?: any []
): Promise <any []> {
return new Promise ((resolve, reject ) => {
conn.execute ({
sqlText,
binds,
complete : (err, stmt, rows ) => {
if (err) reject (err);
else resolve (rows || []);
},
});
});
}
export function connectAsync (
conn : snowflake.Connection
): Promise <snowflake.Connection > {
return new Promise ((resolve, reject ) => {
conn.connect ((err, conn ) => {
if (err) reject (err);
else resolve (conn);
});
});
}
Step 4: Unit Tests with Mocked Snowflake
import { describe, it, expect, vi, beforeEach } from 'vitest' ;
vi.mock ('snowflake-sdk' , () => ({
default : {
configure : vi.fn (),
createConnection : vi.fn (() => ({
connect : vi.fn ((cb ) => cb (null , { getId : () => 'mock-id' })),
execute : vi.fn (({ sqlText, complete } ) => {
if (sqlText.includes ('CURRENT_WAREHOUSE' )) {
complete (null , {}, [{ WAREHOUSE : 'DEV_WH_XS' }]);
} else if (sqlText.includes ('SELECT' )) {
complete (null , {}, [
{ ID : 1 , NAME : 'Alice' },
{ ID : 2 , NAME : 'Bob' },
]);
} else {
complete (null , { getNumUpdatedRows : () => 1 }, []);
}
}),
destroy : vi.fn ((cb ) => cb (null )),
})),
},
}));
import { createSnowflakeConnection, executeQuery, connectAsync } from '../../src/snowflake/connection' ;
describe ('Snowflake Queries' , () => {
it ('should connect and execute a query' , async () => {
const conn = createSnowflakeConnection ();
await connectAsync (conn);
const rows = await executeQuery (conn, 'SELECT * FROM USERS' );
expect (rows).toHaveLength (2 );
expect (rows[0 ].NAME ).toBe ('Alice' );
});
});
Step 5: Integration Tests (Against Real Snowflake)
import { describe, it, expect, beforeAll, afterAll } from 'vitest' ;
import { createSnowflakeConnection, connectAsync, executeQuery } from '../../src/snowflake/connection' ;
describe.skipIf (!process.env .SNOWFLAKE_ACCOUNT )('Snowflake Integration' , () => {
let conn : any ;
beforeAll (async () => {
conn = createSnowflakeConnection ();
await connectAsync (conn);
await executeQuery (conn, `
CREATE TEMPORARY TABLE test_users (
id INTEGER AUTOINCREMENT, name VARCHAR(100)
)
` );
});
afterAll (async () => {
conn?.destroy (() => {});
});
it ('should insert and query data' , async () => {
await executeQuery (conn,
'INSERT INTO test_users (name) VALUES (?)' , ['TestUser' ]
);
const rows = await executeQuery (conn, 'SELECT * FROM test_users' );
expect (rows.length ).toBeGreaterThan (0 );
expect (rows[0 ].NAME ).toBe ('TestUser' );
});
});
Step 6: SnowSQL for Quick Iteration
brew install --cask snowflake-snowsql
cat >> ~/.snowsql/config << 'EOF'
[connections.dev]
accountname = myorg-myaccount
username = my_user
dbname = DEV_DB
schemaname = SANDBOX
warehousename = DEV_WH_XS
rolename = DEV_ROLE
EOF
snowsql -c dev -q "SELECT COUNT(*) FROM my_table"
snowsql -c dev -f sql/migrations/V001__create_users.sql
Error Handling Error Cause Solution 000606: No active warehouseDev warehouse suspended Set AUTO_RESUME = TRUE on warehouse Module not found: snowflake-sdkNot installed Run npm install snowflake-sdk Tests timeoutWarehouse resuming from suspend Increase test timeout to 30s, or pre-warm 002003: Object does not existWrong database/schema context Check .env.local DB and SCHEMA values
Resources
Next Steps See snowflake-sdk-patterns for production-ready code patterns.