# dbt-testpilot demo — nelsonic1/duckdb-dbt (real Olist project)

Records `dbt-testpilot` running against the public **nelsonic1/duckdb-dbt** project (the real
Brazilian Olist e-commerce dataset: raw → staging → warehouse → reporting, 25 models).

`demo-preview.gif` in this folder is a ready-to-view recording of the full workflow. It was
produced from a real, validated run:

- `dbt run` builds **25 models**
- `profile` reads the real data (staging models ~112,000 rows)
- `propose` finds **152** missing tests
- `apply` **verifies each test against the data** and rejects the 4 that would fail —
  the orphan-FK `relationships` on `order_payments` (830 rows) and `order_reviews` (778 rows) —
  then writes **148 verified tests** across 5 files
- `dbt test` → **PASS=211, WARN=2, ERROR=0**

> The preview is a **heuristics-only** run. The `--llm` (Gemini) step could not run where the
> preview was generated because that environment's network blocks Google's API. To record the
> **`--llm` version**, render locally with the tape below — Gemini is reachable from your Mac.

---

## Render the full `--llm` version locally

The exact from-scratch sequence (this is what `demo.tape` records):

```bash
# 1. workspace + clone
mkdir -p ~/dbt-tests && cd ~/dbt-tests
git clone https://github.com/nelsonic1/duckdb-dbt.git
cd duckdb-dbt/dbt

# 2. venv + install
python3 -m venv .venv && source .venv/bin/activate
pip install dbt-duckdb dbt-testpilot google-genai

# 3. key  (create BEFORE recording so it never shows in the GIF)
printf 'LLM_PROVIDER=gemini\nGEMINI_API_KEY=YOUR_KEY\n' > .env

# 4. build
dbt deps
dbt run --profiles-dir .
dbt docs generate --profiles-dir .

# 5. dbt-testpilot
dbt-testpilot profile --project-dir . --db ../duckdb/database.duckdb --out profiles.json
dbt-testpilot propose --profiles profiles.json --out proposals.json --llm
dbt-testpilot apply   --proposals proposals.json --project-dir . --db ../duckdb/database.duckdb --include-custom
#   → at the "approve? [y/n/a/q]" prompt, type:  a
dbt test --profiles-dir .
```

Then record it:

```bash
brew install vhs        # one-time
vhs demo.tape           # -> demo.gif
```

Note: the only change from the steps you gave me is `--db ../duckdb/database.duckdb` added to
`apply` — without it, apply can't find the database (it lives in the sibling `../duckdb/` folder)
and skips the verify-before-write step that rejects the bad tests.

## Turn it into a narrated video (Descript)

1. Connect **Descript** in this app.
2. Import `demo.gif` (or a screen recording of the run).
3. Add an AI voiceover / captions per step, trim dead time, export MP4.

## Security

Create `.env` yourself before recording so your key never appears on screen. Since you pasted the
key into chat to validate this, **rotate/revoke it** in Google AI Studio and use a fresh one locally.
