"Know the bill before you hit run."
Inline, cross-warehouse SQL cost estimation and anti-pattern linting for Snowflake, BigQuery, and Databricks — directly in your VS Code editor, before a query ever executes.
📽️ Demo & Overview

⚡ Why This Exists
- Bill Shock Prevention: Data engineers and analytics engineers currently find out a query was expensive after it ran — via a monthly cloud bill or a Slack notification from Finance.
- Zero Context Switching: Get instant feedback inside VS Code at the exact moment you write your SQL, without switching to warehouse Web UIs.
- Shift-Left FinOps: Catch missing partition filters,
SELECT *scans, and Cartesian join explosions before code reaches pull requests or production DAGs.
✨ Features
- Inline CodeLens Cost Estimates — See estimated bytes scanned and USD cost directly above your SQL queries as you type.
- Cross-Warehouse Connectors — Unified dry-run support for BigQuery, Snowflake, and Databricks under one clean VS Code interface.
- Static Anti-Pattern Linter — Instant parser-based detection of 7 performance anti-patterns with auto Quick Fix code actions (
Cmd+./Ctrl+.). - Interactive Webview Panel — Inspect collapsible query plan trees, cost metric breakdowns, historical cost trends, and triggered rule details.
- Shareable PR Cost Reports — One-click export of markdown cost audit summaries ready to paste into GitHub PR comments.
- CI/CD Cost Gate — Standalone CLI (
npx sql-cost-guard check) and pre-built GitHub Actions workflow to block high-cost queries in PR pipelines. - Zero-Dependency Demo Mode — Immediate offline testing with fixture-backed estimates without entering live cloud credentials.
📊 Supported Data Warehouses & Cost Precision
We believe in complete transparency. Different warehouses bill on fundamentally different metrics, so we present estimates with honest precision ratings:
| Warehouse | Estimation Mechanism | Cost Precision & Terms | Confidence Level |
|---|---|---|---|
| BigQuery | Dry-run query job (dryRun: true) via BigQuery API |
Exact Bytes & USD Cost — calculated on configurable on-demand pricing ($6.25/TiB default). | exact |
| Snowflake | EXPLAIN USING JSON query plan parser |
Bytes Scanned & Credit Range — Snowflake bills per warehouse-second, so we display relative compute impact ratings and credit ranges based on assigned partitions. | directional |
| Databricks SQL | EXPLAIN COST query plan parser |
Bytes Read & DBU-Hour Range — Databricks bills in DBUs by cluster runtime, so we display DBU-hour consumption ranges. | directional |
🚀 Quick Start
- Install the Extension from the VS Code Marketplace.
- Try Offline Demo Mode:
- Open any
.sqlor.jinja-sqlfile. - CodeLens estimates will render immediately in
[DEMO MODE].
- Open any
- Connect Your Live Warehouse:
- Open Command Palette (
Cmd+Shift+P/Ctrl+Shift+P). - Run
SQL Cost Guard: Connect Warehouse Credentials. - Enter your credentials (stored securely in VS Code
SecretStorage).
- Open Command Palette (
- Read our full setup guide in
CONNECTING.md.
⚙️ Configuration Reference
Configure settings in settings.json or VS Code Settings UI:
| Setting Key | Type | Default | Description |
|---|---|---|---|
sqlCostGuard.warehouse |
enum |
"none" |
Active warehouse target ("none" / "bigquery" / "snowflake" / "databricks"). |
sqlCostGuard.bigqueryOnDemandRatePerTiB |
number |
6.25 |
On-demand cost per TiB scanned for BigQuery in USD. |
sqlCostGuard.costThresholdUSD |
number |
1.0 |
Cost threshold in USD above which high-cost warnings trigger. |
sqlCostGuard.partitionColumns |
object |
{ "events": "event_date", ... } |
Map of table names to required partition/clustering column names. |
sqlCostGuard.enableAutoEstimate |
boolean |
true |
Enable automatic debounced (800ms) cost estimation on keystrokes. |
sqlCostGuard.telemetry.enabled |
boolean |
false |
Enable anonymous aggregate usage metrics (disabled by default). |
🛠️ CI/CD Pipeline Cost Gate
Enforce query cost limits in your continuous integration workflow using our CLI:
# Run headless cost & anti-pattern check across all SQL files
npx sql-cost-guard check path/to/sql/files
# Generate machine-readable JSON output for CI pipelines
npx sql-cost-guard check path/to/sql/files --json
🔒 Privacy & Security
We take data security seriously:
- No Credentials Saved in Settings: API tokens and credentials are saved exclusively in VS Code's native OS-level
SecretStorageAPI (Keychain, Credential Manager, Secret Service). - Queries Stay Local / Direct: Query text is sent only directly to your configured cloud warehouse endpoint for dry-run estimation.
- Zero Telemetry by Default: Telemetry is completely disabled by default. Read our full policy in
PRIVACY.md.
🤝 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for build instructions and guidelines.
📄 License
Distributed under the MIT License. See LICENSE for details.