Snowflake

From G1Joshi/Agent-Skills · View interactive version

Snowflake is an AI agent skill from the GitHub repository G1Joshi/Agent-Skills. Expert Snowflake cloud data warehouse assistance covering Virtual Warehouses, Snowpipe, zero-copy cloning, time travel, and Streamlit. Use when building enterprise analytical data warehouses or running big data analytics.

How to use this skill

Skill file

Snowflake

Snowflake is a cloud-native data warehouse. It separates compute ("Virtual Warehouses") from storage, allowing them to scale independently.

When to Use

Quick Start

-- Create warehouse (Compute)
CREATE WAREHOUSE my_wh WITH WAREHOUSE_SIZE = 'X-SMALL';

-- Query JSON directly (Variant type)
SELECT src:sales.order_id::integer
FROM raw_data;

Core Concepts

Multi-Cluster Shared Data Architecture

Decouples centralized cloud storage from independent, autoscaling virtual compute warehouses:

[ Central Cloud Storage (AWS S3 / Azure Blob / GCS) ]
         ├── [ Virtual Warehouse: ETL (Size: X-Large) ]
         ├── [ Virtual Warehouse: BI Reports (Size: Medium, Autoscale) ]
         └── [ Virtual Warehouse: Data Science (Size: Large) ]

Time Travel & Zero-Copy Cloning

Restores historical data and creates instant instant clones without data duplication:

-- Query data as it existed 2 hours ago
SELECT * FROM analytics.orders
AT(OFFSET => -60*120)
WHERE status = 'FAILED';

-- Instant zero-copy clone for testing (takes 2 seconds, zero storage added)
CREATE OR REPLACE DATABASE dev_clone_2026 CLONE production;

Native Semi-Structured VARIANT Querying

Ingests and queries nested JSON, Avro, and Parquet data directly:

SELECT
  raw_payload:user_id::string AS user_id,
  raw_payload:event_name::string AS event_name,
  raw_payload:metadata.device.os::string AS os_system
FROM raw_logs.event_stream
WHERE raw_payload:event_name = 'checkout_completed';

Common Patterns

Zero-Copy Cloning with Time Travel Recovery

Problem: Creating staging replicas of terabyte datasets for testing consumes massive storage and time.

Solution:

Use metadata-only Zero-Copy Cloning with Time Travel:

-- Instantly clone production database without duplicating underlying micro-partitions
CREATE OR REPLACE DATABASE dev_db CLONE prod_db;

-- Recover accidentally dropped or updated table state from 2 hours ago
CREATE OR REPLACE TABLE orders_restored CLONE prod_db.public.orders
  AT (OFFSET => -60*120);

Best Practices

Do:

Don't:

Troubleshooting

| Error | Cause | Solution |

| :-------------------------------------------------- | :----------------------------------------------------------- | :-------------------------------------------------------------------- |

| Warehouse '...' has exceeded maximum credit limit | Long-running queries keeping large virtual warehouse active. | Configure AUTO_SUSPEND = 60 and AUTO_RESUME = TRUE on warehouses. |

| Query compilation error: ambiguous column name | Joins referencing shared column names without table aliases. | Qualify all column references with explicit table aliases. |

| Snowpipe load error: File size exceeds maximum | Staged file too large for streaming ingestion. | Split input files into optimal 100MB-250MB compressed chunks. |

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.