peepshow/ sinks/ snowflake

Reel #85 Cloud data warehouse

peepshow sink / snowflake

SnowflakeInsert each run into a Snowflake table via the SQL API — enterprise data warehouse.

POST one row per peepshow run into a Snowflake table via the SQL API v2. Auto-creates the table on first write; subsequent runs append. Works against any Snowflake account — AWS, Azure, or GCP.

drop · process · snowflake

What it does

[Snowflake](https://www.snowflake.com/) is the cloud data warehouse most enterprises run their analytics on. This sink writes one row per peepshow run to a Snowflake table via the [SQL API](https://docs.snowflake.com/en/developer-guide/sql-api/intro) (`POST /api/v2/statements`). Auth is a [programmatic access token (PAT)](https://docs.snowflake.com/en/user-guide/programmatic-access-tokens) sent as a Bearer header — no driver to install, no key-pair JWT, no clock skew to debug. The first write auto-creates the table with the standard peepshow schema (`run_id · title · frames · duration · transcript · thumbnail_url · strategy · tags VARIANT · created_at`); subsequent runs append. Tags are stored as `VARIANT` so they're queryable with Snowflake's native JSON functions.

When to reach for it

  • Pipe peepshow runs into the same Snowflake schema your product analytics already lives in
  • Build dashboards over run history with Snowsight, Tableau, Looker, or any other Snowflake-aware BI
  • Hand a write-only PAT to a CI job that records every QA video into a shared analytics warehouse

Install

npm i -g peepshow

Use it

SNOWFLAKE_ACCOUNT="xy12345.us-east-1" \
SNOWFLAKE_TOKEN="$(< ~/.snowflake-pat)" \
SNOWFLAKE_DATABASE="ANALYTICS" \
peepshow ./demo.mp4 --sink snowflake

Make it automatic

Register the sink once — every run fires it afterward. Scope by --when so it only runs for matching videos.

peepshow sinks add snowflake
peepshow sinks add snowflake --when extension=mp4,mov
peepshow sinks add snowflake --when path=/Volumes/Work/

Configuration

  • SNOWFLAKE_ACCOUNT Account identifier including region, e.g. `xy12345.us-east-1` or `xy12345.privatelink`. required
  • SNOWFLAKE_TOKEN Programmatic access token (PAT). Generated under User → Security → Programmatic access tokens in the Snowflake console. required
  • SNOWFLAKE_DATABASE Target database. Required. required
  • SNOWFLAKE_SCHEMA Schema name. Default `PUBLIC`.
  • SNOWFLAKE_TABLE Table name. Default `PEEPSHOW_RUNS`. Auto-created on first write.
  • SNOWFLAKE_WAREHOUSE Optional compute warehouse to bill the query to.
  • PEEPSHOW_FRAME_BASE_URL When set, the first frame URL is written to the `thumbnail_url` column.

Use with an LLM agent

Every peepshow sink reads its config from env vars and receives a single JSON payload on stdin. An LLM agent (Claude Code, Cursor, Windsurf, Gemini, Codex) can drive the Snowflake sink automatically when three things are true:

  • the env vars below are exported in the agent's shell (or a project .env it can load),
  • the peepshow CLI is on PATH — install with npm i -g peepshow,
  • a peepshow auto-sink is registered for the run (optional but recommended — makes invocation zero-argument).

1. Set the environment

# Add to ~/.zshrc, ~/.bashrc, or a project .env the agent can load
export SNOWFLAKE_ACCOUNT="..."
export SNOWFLAKE_TOKEN="..."
export SNOWFLAKE_DATABASE="..."

2. Register as an auto-sink

peepshow sinks add snowflake
peepshow sinks add snowflake --when extension=mp4,mov

3. Example LLM session

You → drop a .mov into Claude Code.

Claude → auto-invokes /peepshow:slides ./clip.mov. peepshow extracts frames + audio, the Snowflake sink forwards the run to the configured database. Claude replies with a summary and a link to the created record.

The transcript rides along in the payload whenever the audio pass transcribes successfully.

Write your own

A sink is any executable that reads the --emit json payload on stdin. Shell, Node, Python, Go — the spec's in docs/PLUGINS.md. Register persistent ones with peepshow sinks add-cmd 'your-command'.