home / skills / michalvavra / agents / snowcli

snowcli skill

/skills/snowcli

This skill helps you query Snowflake data and manage objects efficiently from the SnowCLI, using json-formatted outputs for easy automation.

npx playbooks add skill michalvavra/agents --skill snowcli

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
1.6 KB
---
name: snowcli
description: CLI for Snowflake. Query data, manage warehouses, databases, schemas, tables, and stages. Use when working with Snowflake data platform.
compatibility: Requires snow CLI (docs.snowflake.com/en/developer-guide/snowflake-cli). Needs ~/.snowflake/config.toml with connection config.
---

# snowcli

CLI for Snowflake via [Snowflake CLI](https://docs.snowflake.com/en/developer-guide/snowflake-cli).

## Quick Reference

```bash
# Run SQL query (use --format json for pipeable output)
snow sql -q "SELECT * FROM table LIMIT 10" --format json

# Show objects
snow sql -q "SHOW WAREHOUSES" --format json
snow sql -q "SHOW DATABASES" --format json
snow sql -q "SHOW SCHEMAS" --format json
snow sql -q "SHOW TABLES" --format json
snow sql -q "SHOW TABLES IN database.schema" --format json

# Describe table structure
snow sql -q "DESCRIBE TABLE database.schema.table" --format json

# Object commands
snow object list warehouse --format json
snow object list database --format json
snow object list schema --format json
snow object list table --format json

# Connection test
snow connection test
```

## Output Formats

Always use `--format json` for agent workflows (pipeable to jq):

```bash
snow sql -q "SHOW TABLES" --format json | jq '.[].name'
snow sql -q "SELECT * FROM t" --format json | jq 'length'
```

Available formats: `json`, `csv`, `tsv`, `plain`, `table` (default).

## Specifying Connection

```bash
snow sql -q "SHOW TABLES" -c connection_name
```

---

See [references/setup.md](references/setup.md) for configuration and authentication.
See [references/examples.md](references/examples.md) for query patterns and workflows.

Overview

This skill provides a command-line interface for interacting with Snowflake through the Snowflake CLI. It helps you run queries, inspect and manage warehouses, databases, schemas, tables, and stages, and integrates easily into scripted or agent-driven workflows. Use JSON output for pipeable, machine-friendly results.

How this skill works

The tool executes SQL and object-management commands against a configured Snowflake connection. Commands like snow sql and snow object run queries or list objects; using --format json produces structured output suitable for jq or other processors. You can target specific connections with -c and validate connectivity with snow connection test.

When to use it

  • Run ad-hoc queries or scripted SQL from the terminal or CI pipelines.
  • List and inspect Snowflake objects (warehouses, databases, schemas, tables, stages).
  • Integrate Snowflake data checks into automation by piping JSON into jq.
  • Validate connection and authentication before running jobs.
  • Describe table structures and export results in CSV/TSV for downstream tooling.

Best practices

  • Always use --format json for programmatic workflows to ensure predictable parsing.
  • Define named connections and use -c to avoid exposing credentials in scripts.
  • Pipe JSON output to jq for filtering, counts, and transforms in CI or agents.
  • Prefer SHOW and DESCRIBE commands for quick metadata inspection instead of expensive queries.
  • Test connections with snow connection test during deployment and troubleshooting.

Example use cases

  • Run a quick SELECT and return results as JSON: snow sql -q "SELECT * FROM table LIMIT 10" --format json
  • List all warehouses and parse names with jq: snow sql -q "SHOW WAREHOUSES" --format json | jq '.[].name'
  • Describe table columns for schema migration planning: snow sql -q "DESCRIBE TABLE db.schema.table" --format json
  • Automate inventory of tables across environments: snow object list table --format json | jq '.'
  • Validate CI job can connect to Snowflake before executing pipeline: snow connection test

FAQ

How do I get machine-readable output?

Use --format json on snow sql or snow object commands and pipe the output to jq or another JSON tool.

Can I target a specific connection?

Yes. Add -c connection_name to your snow commands to run against a named connection.