agentsclimarketplace

Snowflake query

Skill haggler09/claude-haggler-skills/skills/snowflake-query

Execute SQL queries against Snowflake data warehouse using Python connector. Supports password, key-pair, and SSO/OAuth authentication. Use for ad-hoc queries, data extraction, and schema exploration. Output in JSON, table, or CSV format.From its SKILL.md

Install
npx -y skills add haggler09/claude-haggler-skills --skill snowflake-query

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

5.7 KB, as published. Nobody here has run it

Snowflake Query Execution

Overview

Execute SQL queries against Snowflake with support for:

  • Multiple authentication methods (password, key-pair, SSO/OAuth)
  • Flexible output formats (JSON, table, CSV)
  • Connection parameter overrides
  • Query timeout and row limits

Quick Start

1. Set Environment Variables

# Required
export SNOWFLAKE_ACCOUNT="your-account.region"
export SNOWFLAKE_USER="your_username"

# Password authentication
export SNOWFLAKE_PASSWORD="your_password"

# Optional defaults
export SNOWFLAKE_DATABASE="MY_DB"
export SNOWFLAKE_SCHEMA="PUBLIC"
export SNOWFLAKE_WAREHOUSE="COMPUTE_WH"
export SNOWFLAKE_ROLE="ANALYST"

2. Run Query

# Inline query (JSON output)
uvx --with snowflake-connector-python python scripts/query.py \
  --query "SELECT * FROM my_table"

# From file with table output
uvx --with snowflake-connector-python --with tabulate python scripts/query.py \
  --file query.sql --format table

# Export to CSV
uvx --with snowflake-connector-python python scripts/query.py \
  --query "SELECT * FROM my_table" --format csv --output result.csv

Authentication Methods

Password Authentication

Set SNOWFLAKE_PASSWORD environment variable.

export SNOWFLAKE_PASSWORD="your_password"

Key-Pair Authentication

# Option 1: File path
export SNOWFLAKE_PRIVATE_KEY_PATH="/path/to/rsa_key.p8"

# Option 2: Base64-encoded key content
export SNOWFLAKE_PRIVATE_KEY_RAW="<base64-encoded-key>"

# Optional: If key is encrypted
export SNOWFLAKE_PRIVATE_KEY_PASSPHRASE="passphrase"

SSO/OAuth Authentication

# Browser-based SSO
export SNOWFLAKE_AUTHENTICATOR="externalbrowser"

# OAuth token
export SNOWFLAKE_AUTHENTICATOR="oauth"
export SNOWFLAKE_OAUTH_TOKEN="your_oauth_token"

CLI Options

OptionShortDescriptionDefault
--query-qSQL query string-
--file-fSQL file path-
--format-Output format (json/table/csv)json
--output-oOutput file pathstdout
--limit-lRow limit100
--no-limit-Disable row limitfalse
--database-Override databaseenv
--schema-Override schemaenv
--warehouse-Override warehouseenv
--role-Override roleenv
--timeout-Query timeout (seconds)300
--dry-run-Test connection onlyfalse
--verbose-vVerbose outputfalse

Output Formats

JSON (default)

{
  "status": "success",
  "query_id": "01b12345-...",
  "execution_time_ms": 234,
  "row_count": 3,
  "columns": ["id", "name", "created_at"],
  "rows": [
    {"id": 1, "name": "Alice", "created_at": "2024-01-01"},
    {"id": 2, "name": "Bob", "created_at": "2024-01-02"}
  ]
}

Table

+----+-------+------------+
| id | name  | created_at |
+----+-------+------------+
|  1 | Alice | 2024-01-01 |
|  2 | Bob   | 2024-01-02 |
+----+-------+------------+

CSV

id,name,created_at
1,Alice,2024-01-01
2,Bob,2024-01-02

Examples

Basic Query

uvx --with snowflake-connector-python python scripts/query.py \
  -q "SELECT CURRENT_TIMESTAMP()"

Schema Exploration

uvx --with snowflake-connector-python --with tabulate python scripts/query.py \
  -q "SHOW TABLES IN SCHEMA my_db.public" --format table

Data Export

uvx --with snowflake-connector-python python scripts/query.py \
  -f export.sql --format csv -o data.csv --no-limit

Connection Test

uvx --with snowflake-connector-python python scripts/query.py --dry-run

Override Connection Parameters

uvx --with snowflake-connector-python python scripts/query.py \
  -q "SELECT * FROM table" \
  --database PROD_DB \
  --schema ANALYTICS \
  --warehouse LARGE_WH

Environment Variables Reference

VariableRequiredDescription
SNOWFLAKE_ACCOUNTYesAccount identifier (e.g., abc12345.us-east-1)
SNOWFLAKE_USERYesUsername
SNOWFLAKE_PASSWORDAuth*Password (for password auth)
SNOWFLAKE_PRIVATE_KEY_PATHAuth*Private key file path (for key-pair auth)
SNOWFLAKE_PRIVATE_KEY_RAWAuth*Base64-encoded private key
SNOWFLAKE_PRIVATE_KEY_PASSPHRASENoPrivate key passphrase
SNOWFLAKE_AUTHENTICATORAuth*externalbrowser or oauth
SNOWFLAKE_OAUTH_TOKENNoOAuth token (when authenticator=oauth)
SNOWFLAKE_DATABASENoDefault database
SNOWFLAKE_SCHEMANoDefault schema
SNOWFLAKE_WAREHOUSENoDefault warehouse
SNOWFLAKE_ROLENoDefault role

*Auth: At least one authentication method is required.

Dependencies

Run with uvx to automatically handle dependencies:

# Basic (JSON/CSV output)
uvx --with snowflake-connector-python python scripts/query.py ...

# With table output
uvx --with snowflake-connector-python --with tabulate python scripts/query.py ...

Error Handling

Errors are output in JSON format:

{
  "status": "error",
  "error_code": "AUTH_FAILED",
  "error_message": "Authentication failed: incorrect username or password"
}

Exit Codes

CodeDescription
0Success
1Configuration error (missing env vars, invalid options)
2Authentication error
3Connection error
4Query error (SQL syntax, permissions)
5Output error (file write failed)

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.