# Snapshots

`sqldash snapshot` renders dashboards to static PNGs plus a self-contained
`index.html` gallery. It is the path for stakeholders and wallboards. Whoever runs the
snapshot supplies the warehouse credentials, and viewers need none. Commit the files,
drop them in a bucket, or paste a PNG into a doc.

```bash
sqldash snapshot
sqldash snapshot -d orders -d growth --theme light -o renders/
sqldash snapshot git@github.com:acme/dashboards.git
```

| option | does |
| --- | --- |
| `-o`, `--out` | Output directory. Default `snapshots/`. |
| `-d`, `--dashboard` | Only these dashboards; repeatable. Default: all. |
| `--theme` | `dark` (default) or `light`. |
| `--width` | Viewport width in pixels, rendered at 2x. Default 1440. |
| `-b`, `--branch` | Branch to check out, for git URLs. |
| `--all` | Snapshot every registered repo. |

It needs the `snapshot` install extra and a one-time Chromium download.

```bash
uv tool install 'sqldash[snapshot,snowflake]'                   # snapshot plus your warehouse extra
uvx --from 'sqldash[snapshot]' playwright install chromium     # the browser it drives
```

With pip, `pip install 'sqldash[snapshot]'` puts `playwright` on your `PATH`, and
`playwright install chromium` does the same download.

It serves the project on a private local port, waits for every tile to finish loading,
and captures each dashboard with headless Chromium.

A dashboard that fails to load is never dropped silently. The rest still render, the
gallery shows a "failed to load" card in its place, the reason goes to stderr, and the
command exits 1 so a scheduled job notices. If no dashboard loads, nothing is written,
a gallery already in the output directory is left alone, and the command exits 1.

In CI, run `sqldash snapshot` on a schedule with warehouse credentials in the runner and
publish `snapshots/` to static hosting. Everyone gets a fresh wallboard, and no
credentials sit in the serving path.
