Offline capture and preflight
This tool renders read-only Snowflake worksheets and records an operator's exported metadata CSV. It has no connector, executor, network calls, AI dependency, credential reader or account-changing command. **Native compatibility gate: NOT RUN.** Synthetic tests establish local behavior only. A supplied query ID and attestation are operator claims, not authenticated Snowflake receipts or proof of complete privileges.
Render
Use Python 3.10+ with PYTHONPATH=src. Save the following as /tmp/assessment-config.json, replacing declarations only after the scope owner approves them:
{
"account": "EXAMPLE-ACCOUNT",
"role": "ASSESSMENT_READER",
"warehouses": ["APP_WH"],
"window_start": "2026-11-01T00:00:00Z",
"window_end": "2026-11-02T00:00:00Z",
"row_limit": 10000,
"evidence_kind": "synthetic"
}PYTHONPATH=src python -m sf_eval.capture render --config /tmp/assessment-config.json --output /tmp/assessment-planConfig has exactly those seven keys. client_metadata is the other evidence kind. Account/role are bounded uppercase declarations; warehouses are 1–100 distinct uppercase unquoted identifiers, matched exactly. Quoted/case-sensitive warehouse names are unsupported: request an owner-approved manual mapping rather than uppercase them. The window is canonical UTC seconds, positive and at most 31 days. Row limit is an integer 1–10000. Outputs must be fresh directories outside the checkout; all paths reject traversal and symlink components. Inputs are regular files, at most 16 MiB (JSON 256 KiB), cells 4096 characters. CSV is strict UTF-8 with exact ordered headers, no control characters, extra sensitive fields or variable-width rows. Empty cells stay null; numeric cells must be finite and bounded. No spreadsheet is launched; preserved raw CSV is untrusted and should not be opened with spreadsheet formula execution enabled.
The output contains plan.json, PREFLIGHT.sql and three source worksheets. Review and retain the config/plan as an approved scope record. Recording recomputes every approved worksheet and its hash; altered SQL, arbitrary SQL files, or arbitrary additional SQL statements are refused. This detects content mismatch, not authorization: an actor who creates a different valid config creates a different valid plan. Files do not authenticate scope approval. Keep the approved plan/config in the client's controlled evidence store.
Client-run export
Run preflight in the authorized client session. Compare actual account, role and collection warehouse with the approved declarations; the local tool cannot verify them. A Snowflake account locator returned by CURRENT_ACCOUNT() may need explicit owner reconciliation with an account name. Use an existing approved collection warehouse where SELECT requires compute; this tool never starts or changes one explicitly. Select the authorized role in the client UI; no grants or role changes are emitted.
Least privilege: the operator needs only visibility of the exact approved warehouse configuration and SELECT access to the two named Account Usage views. Have the client's Snowflake administrator provision the least scoped applicable Snowflake database roles/access; do not default to ACCOUNTADMIN or broaden privileges on failure. Role visibility can hide warehouses or history. Account Usage latency, retention and permissions mean COMPLETE is an operator's bounded-source attestation, not proof of estate completeness.
For configuration, execute SHOW WAREHOUSES and its following RESULT_SCAN(LAST_QUERY_ID()) SELECT immediately, in the same session, without an intervening statement. **Export only the filtered SELECT result**, never the full SHOW output. SHOW itself can reveal other visible warehouse metadata in the client UI; if that visibility is not authorized, do not run it—use approved manual export. SHOW has a platform result ceiling; an omitted authorized warehouse is not proof of absence. Record the filtered SELECT's query ID, not an invented ID. All other worksheets explicitly restrict exact warehouse names, time and count; no query text, bind values or patient rows are selected. A limit bounds returned rows, not underlying Snowflake work or credits; get owner approval for the window/collection warehouse before running.
Official source definitions checked for this implementation: SHOW WAREHOUSES, WAREHOUSE_LOAD_HISTORY, QUERY_HISTORY. Native SQL and export formatting still require separate observed qualification.
Record
Export CSV with headers, timestamps exactly as rendered in UTC (six fractional digits for native source time columns) and nulls as empty cells. Do not export extra columns. Record one source per output, then pass multiple capture directories to normalization:
PYTHONPATH=src python -m sf_eval.capture record --plan /tmp/assessment-plan --source WAREHOUSE_CONFIG --input /tmp/warehouse-config.csv --status COMPLETE --query-id actual-client-query-id --observed-at 2026-11-02T01:00:00Z --attestation 'Operator name: approved filtered export; reviewed scope and visibility limitations' --output /tmp/config-capture--source-kind normally defaults to the native mapping. --evidence-kind may assert the plan kind but cannot relabel it. Native COMPLETE/EMPTY requires an actual supplied query ID and nonblank attestation. For unavailable evidence omit --input and --query-id, and use DENIED, UNSUPPORTED or UNKNOWN with an explanatory attestation. These remain distinct and never imply health. Native QUERY_WORK recording also requires EXECUTION_STATUS=SUCCESS, a nonnull end time and completion at or before the collection window end; otherwise recording refuses the export. PARTIAL requires CSV. Header-only COMPLETE becomes EMPTY; any source reaching the row cap becomes PARTIAL, even if declared COMPLETE; exports exceeding cap are refused. EMPTY with rows is refused. Denied/unsupported/unknown cannot contain data rows. Every identifiable warehouse must be in the plan allowlist, and native time rows must match the collection window. Configuration is a current snapshot at observed_at, not historical configuration reconstructed across the window.
The manifest uses sf-assessment-capture-v1, account/role/window/warehouses/limit/evidence kind, and a source record with source name/kind/status, copied relative CSV path, SHA256, row count, query ID, observed time, attestation and source window. CSV bytes are preserved exactly. It contains no authentication guarantee; never substitute synthetic evidence after a denied client read. No output overwrite is allowed.
Columns, mappings and fallback
| Source/kind | Exact ordered exported columns | Normalization meaning |
| WAREHOUSE_CONFIG / raw_show_warehouses | name,size,type,auto_suspend,min_cluster_count,max_cluster_count | Name, size/type, suspend seconds and cluster limits; snapshot from attested observed time. Owner latency target stays unknown without attributed manual context. |
| WAREHOUSE_LOAD / raw_warehouse_load | START_TIME,END_TIME,WAREHOUSE_NAME,AVG_RUNNING,AVG_QUEUED_LOAD,AVG_QUEUED_PROVISIONING,AVG_BLOCKED | Native interval averages; interval seconds derive from end minus start. Only whole intervals within window are selected. |
| QUERY_WORK / raw_query_history | QUERY_ID,WAREHOUSE_NAME,START_TIME,END_TIME,QUERY_PARAMETERIZED_HASH,QUERY_PARAMETERIZED_HASH_VERSION,EXECUTION_TIME,TOTAL_ELAPSED_TIME,BYTES_SPILLED_TO_REMOTE_STORAGE,BYTES_SCANNED,ROWS_PRODUCED,EXECUTION_STATUS | Milliseconds and bytes retain native units; hash plus version forms family identity. The worksheet selects successful completed queries only, with start and end within the window; EXECUTION_STATUS remains auditable. This population does not describe failure rates or in-flight work. |
Native query/load timestamps preserve six fractional digits in UTC; scope config and observed_at require whole seconds. Query history is bounded warehouse work, excluding warehouse-null/serverless operations. Hashes are not proof that underlying query text contains no sensitive literals; assess export approval with the client. Config/load/query inputs support warehouse configuration, queue/load and execution observations; they do not establish business impact, safe targets, required access paths, policy effectiveness or all 74 controls.
Manual fallback supports --source-kind normalized_csv for any of the 12 non-SOURCE_COVERAGE tables in sql/practices/schema.json, with exactly that table's ordered column names and numeric types. Include required --manual-source 'Named owner, dated export or approved context reference'; this is preserved as the extra manual_source provenance field on that source record. Such manually attributed sources may omit query IDs; never invent them. --attestation is still mandatory. For a native-shaped source explicitly choosing normalized_csv, use the normalized table schema rather than the raw header. For **normalized_csv QUERY_WORK only**, add --query-population SUCCESS_COMPLETED. This exact structured declaration is required even for manual data; it is recorded as query_population alongside named manual_source and the operator attestation. It attests that every row is a successful query completed within the approved window. Other tables and native source kinds reject this field; native QUERY_WORK carries its own EXECUTION_STATUS column. The declaration is not authenticated and must be verified by the operator against the source export. A free-text statement is never parsed as a substitute. Missing or failed populations require UNKNOWN/unsupported handling outside this successful-query table, never a fabricated ID or success claim. No role-grant/object-name inference or private-data extraction is performed. Use the normalizer's attributed context route when owner business facts are unavailable as approved CSV; missing sources remain UNKNOWN.
Checks and scope
PYTHONPATH=src python -m unittest discover -s tests -p test_capture.py -vTests exercise actual render/record subprocesses, synthetic native-shaped exports, cap downgrade, denied/unknown/empty distinctions, scope injection, SQL/hash tampering, null preservation, unsafe headers/numbers, provenance requirements, overwrite and symlink refusal. Client-native execution, least-privilege behavior, platform limits and actual query receipts remain **NOT RUN** until separately observed.