BigQuery Query Guard
Can you explain a query’s cost before running it?
Read recorded SQL comparisons, then inspect authorization, scoped caching and query byte limits.
The problem
A small result does not imply a small scan. Applications also need to decide who may query, when a cached answer is valid and which requests must be stopped before execution.
The approach
- Compare SQL first, then its recorded scan estimate, runtime, billed bytes and output. Keep those measurements distinct.
- Authorize every request before cache lookup, scope reusable results and reject estimates that exceed a configured byte budget.
- Pass a byte limit to the query engine and expose a trace. Use a separate offline sandbox to inspect cache and authorization behavior.
What you can inspect
The default lab replays eight Bakiano query scenarios with bundled SQL and execution evidence. The separate /guard sandbox exercises the query boundary with simulated adapters.
Scope & limitations
The browser replays recordings and makes no Google Cloud queries. Recorded timings are observations, not general performance promises. Sandbox billing and warehouse behavior are simulated.
Run it locally
Node.js 22 or newer. The default lab needs no API key or cloud account.
git clone https://github.com/alejandrofrank/bigquery-query-guard.git
cd bigquery-query-guard
npm run devThen open http://127.0.0.1:4312. Follow the repository for optional integrations and verification commands.