DATA OPS

BigQuery Cost Guard on Pull Request

On every pull request that touches a scheduled query, it dry-runs the new SQL against BigQuery, compares estimated bytes scanned to the base branch.

CategoryData Ops
Enginesim
Difficultyadvanced
Triggerevent
Steps5
Setup~25 min

How it runs

The automated pipeline, trigger to output.

  • TriggerPull request touches query filesGitHubGitHub
  • ActionFetch head and base SQLGitHubGitHub
  • ActionBigQuery dry-run estimates bytes each versionGoogle BigQueryBigQuery
  • LogicCompute delta, decide pass/fail
  • OutputPost blocking check + comment to PRGitHubGitHub

What it does

Catches BigQuery cost regressions before they merge: on a pull request it dry-runs both the changed and base-branch SQL, compares estimated bytes processed, and posts a pass/fail check with the cost delta.

When to use it

When scheduled queries live in a Git repo and you want a guardrail that stops a partition-killing change from ever reaching production, rather than detecting it the next morning.

How it works

  1. 1A GitHub pull request event triggers the run when files under your queries directory change.
  2. 2A GitHub action fetches the changed SQL from the PR head and the matching SQL from the base branch.
  3. 3A BigQuery dry-run estimates bytes processed for each version without running the query.
  4. 4A logic step computes the percent increase and decides pass or fail against your budget tolerance.
  5. 5A GitHub action posts a check status and a comment showing estimated bytes before and after.
  6. 6On a material regression the check fails and blocks the merge.

Set it up

What you configure once, before turning it on.

  1. 1
    Connect GitHubRepos, issues, pull requests, actions.
  2. 2
    Connect BigQueryDatasets, queries, schemas.
  3. 3
    Set each agent's modelWe leave models unset so you pick the tier — fast + cheap, or top-quality.
  4. 4
    Tune it to your dataEdit the prompts, filters, and field mappings so it matches how your team works.
  5. 5
    Test, then turn it onRun once against a sample, confirm the output, then enable the trigger.

Run this workflow in your colony.

14-day trial. No DevOps. No Sales call. Provisioned in under a minute.