# Snowflake assessment: best practices → SQL → evidence → roadmap

For a six-week **advisory** engagement. Deliver the current state, what is working, evidence-backed problems, and a prioritized remediation roadmap. Production remediation is a separately authorized phase. All runtime analysis is deterministic; no AI is needed. Windows Jupyter and warehouse-runtime Streamlit replace the proposed Excel dashboards.

## Start with actual queries

1. Read [the governing best-practices guide](docs/best-practices-guide.md). `practices.json` contains the 74-practice baseline and the honest implementation coverage: 92 checks map to all74practices:70metadata checks,1approved query-profile check and21supplied-evidence validations;55practices have metadata/profile signals and19rely on supplied-evidence validation. No practice is fully proven by these checks.
2. Open `sql/direct-live/AP00_session.sql` to record context, then run selected `AP01`–`AP92` SELECTs in Snowsight or another approved Snowflake SQL client. **No Python, project database, application or export pipeline is required.** Edit each query's `cfg` window, scope and heuristics first. See `catalog.json` for expected behavior, interpretation, remediation and owner validation.
3. Or open [the direct SQL Jupyter notebook](notebooks/direct_antipattern_queries.ipynb): all92actual queries is visible in a `%%sql` cell with the same practice guidance. Never save sensitive outputs in the distributed notebook.
4. For repeatable dashboard reporting, deploy the separate SQL view layer below and use [the reporting notebook](notebooks/assessment.ipynb) or [native Streamlit dashboard](dashboards/streamlit_app.py). The assessment calculations remain SQL in Snowflake.

`CANDIDATE` = measured review lead; `CONTEXT` = descriptive observation; `UNKNOWN` = insufficient evidence. These are neither verified violations nor pass/fail health scores. Empty output is not a healthy result. Read denied/missing/partial/unsupported status in `REPORTING.V_COVERAGE` before interpreting any reporting signal.

## Stable SQL architecture

```text
Live SNOWFLAKE.ACCOUNT_USAGE ──┐
                              ├─ SOURCE views → ANALYSIS views → REPORTING views
Approved copies in RAW tables ┘                                  ├─ Jupyter SQL
                                                                 └─ Native Streamlit
```

Consumers retain the same reporting-view names while an approved operator retargets project-owned `SOURCE` views. Copy refresh never becomes live evidence: original capture times and observation windows remain visible. A manual source-registry attestation records completeness, visibility, source mode and operator. Retargeting clears prior completeness approval.

[Deployment and collection runbook](docs/deployment-runbook.md) · [Notebook/dashboard guide](docs/notebook-dashboard-guide.md) · [View contract](contracts/INTERFACE.md)

## Release limits

Native Snowflake compilation, deployment, Jupyter connection and native dashboard rendering for **this release** are NOT RUN. Local parser and translated DuckDB fixture tests provide offline evidence only. Prior TVIQ qualification belongs to a different bundle and does not qualify these new SQL/views. All client practices remain NOT ASSESSED. No client data, credentials, query text, binds or patient records are included.

Setup/retarget scripts change only a fresh dedicated namespace and require separate execution by an authorized operator. Native analysis uses SELECT and explicitly identified read-only SHOW captures. SHOW checks require the actual capture query ID; time-sensitive snapshots also require the original capture timestamp. Supplied-evidence checks validate approved inputs only. Never run setup using a client's existing database name. The namespace `SF_EVAL_REVIEW_20261105` must be unused; on collision choose and consistently review a fresh namespace, including consumers, before executing anything.

## Offline development

Run `tools/build_pack.py`, then `tools/build_practices.py`, then `notebooks/build_direct_notebook.py`. The pack generator produces direct SQL, source contracts, setup/retarget and reporting views from the catalog and canonical SELECTs. The practice builder reconciles actual mappings and evidence methods; the notebook builder exposes every query. Tests require isolated development-only `duckdb==1.4.2`, `sqlglot==28.0.0`, and pandas for consumer checks; these are not dependencies of the native SQL checks. `tools/rehearse.py` executes the real SELECTs against synthetic metadata after explicit dialect translation. This is not native qualification.
