A warehouse assistant drafts a query. A policy layer adds a tenant filter, then an operator approves the rewritten statement. The model's proposed SQL and the database's execution record answer different audit questions. Keeping the prompt cannot establish which rows the warehouse examined.
Decide which evidence answers each question
For an execution investigation, keep an execution ID from the database when available, a correlation ID, the version of the statement or its template, the version of the rewrite policy, the approved artifact and the final status. Parameter values can be sensitive. Use approved field-level handling and restricted references where needed. A statement hash helps establish equality using the same normalization, but cannot reconstruct a statement on its own.
For an investigation into generation, the template version, model configuration and retrieval snapshot references may be sufficient. Retain raw prompts or SQL containing literals only when the purpose justifies the exposure and access and deletion policies cover every sink. A replay with a model version pinned may still produce another candidate.
Test the joins
Create one rejected draft, one draft rewritten before execution and one client timeout after submission. The rejected draft should have a recorded decision and zero executions. For the rewritten draft, confirm that approval refers to the final statement version and that its execution ID joins back to the proposal. For the timeout, compare with the warehouse's own query history before assigning a final state. A controller's request timestamp alone records an attempt.
Report executed statements missing a decision separately from drafts that correctly ended in rejection. Review access to the two records independently: someone investigating model wording may have no reason to see production parameter values.
OpenTelemetry sensitive data guidance
This article was created with AI assistance.
Top comments (0)