sql-test-generator

Official

Automate BigQuery SQL unit tests, effortlessly.

Authormozilla
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Manually writing unit tests for BigQuery SQL queries is time-consuming, error-prone, and complex, especially with intricate data structures and BigQuery-specific nuances. This skill automates the creation and management of these tests, preventing accidental production data queries and ensuring query logic is validated efficiently.

Core Features & Use Cases

  • Automated Test Generation: Creates unit test fixtures (input, expected output, query parameters) for BigQuery SQL queries following bigquery-etl conventions.
  • Production Query Prevention: Proactively identifies and prevents tests from accidentally querying production data by ensuring all source tables have synthetic fixtures.
  • Comprehensive Validation: Handles complex query patterns (JOINs, UNION ALL, nested structures, TIMESTAMP formats) and provides clear guidance for common test failures.
  • Use Case: A data engineer modifies a complex BigQuery SQL query. Instead of manually updating dozens of test fixtures, they use this skill to automatically generate or update all necessary input and output YAML files, ensuring the new logic is validated without hitting production.

Quick Start

Generate unit tests for the BigQuery query located at sql/my-project/my-dataset/my-table/query.sql. Ensure all source tables are covered with synthetic data.

Dependency Matrix

Required Modules

None required

Components

referencesassets

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: sql-test-generator
Download link: https://github.com/mozilla/bigquery-etl-skills/archive/main.zip#sql-test-generator

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository