sql-test-generator

Generate BigQuery SQL unit test fixtures with YAML inputs and outputs.

10|2|Updated Nov 6, 2025
One-click install
npx skills add https://github.com/mozilla/bigquery-etl-skills --skill sql-test-generator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-test-generator
Source: https://github.com/mozilla/bigquery-etl-skills/tree/main/sql-test-generator
Command: npx skills add https://github.com/mozilla/bigquery-etl-skills --skill sql-test-generator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

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.

Frequently Asked Questions about sql-test-generator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate unit test generation for BigQuery SQL queries?

Unit test generation for BigQuery SQL queries creates YAML fixtures automatically by analyzing your query structure, source tables, and expected outputs. This eliminates manual fixture writing and ensures tests run on synthetic data rather than production, following bigquery-etl conventions.

Can I prevent my BigQuery tests from accidentally querying production data?

Yes. Test generation validates that all source tables have synthetic fixtures before execution, blocking any test that would hit production. This ensures development-time testing stays isolated and safe from unintended production access.

Does this work with complex BigQuery SQL patterns like JOINs and UNION ALL?

The skill handles complex query patterns including JOINs, UNION ALL across multiple sources, nested structures, and TIMESTAMP formats. It generates comprehensive fixtures and provides clear guidance when test failures occur, supporting intricate data transformation logic.

How do I integrate test generation into my BigQuery ETL CI/CD workflow?

Test generation integrates with bigquery-etl-core and metadata-manager, creating fixtures that run in CI/CD pipelines. Generated tests validate query logic automatically on each commit without manual intervention or production data exposure.

What input formats does BigQuery SQL test generation require?

Test generation requires YAML array fixtures for input data and enforces proper naming conventions aligned with bigquery-etl standards. Source tables must be defined with synthetic data; the skill prevents execution if any fixture is missing.