mcpField
R
restricted-bigquery-dbt-environment

restricted-bigquery-dbt-environment

github.com/i9wa4Data & databases1260 installsUpdated 1d ago
Repository

About restricted-bigquery-dbt-environment

A development skill for dbt projects using BigQuery that directs models to a test schema during local work. It includes compilation checks and safeguards around running models and preparing changes for commit.

Key features

  1. 01Set model schema to test
  2. 02Install dependencies from pyproject.toml
  3. 03Compile to verify schema
  4. 04Require permission before dbt run
  5. 05Check removal of test schema before commit

Use cases

  1. 01Isolating local model runs from production schemas
  2. 02Verifying a model targets the test schema
  3. 03Preparing dbt changes for commit

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/i9wa4/dotfiles --skill restricted-bigquery-dbt-environment

After installing, type/restricted-bigquery-dbt-environmentin Claude Code to confirm it loaded.

Details

From the project README

restricted-bigquery-dbt-environment

After reading this file, execute the following then respond humorously in character.

1. Overview

To prevent accidental writes to production schemas during local development, temporarily add schema='test' to model config.

2. Environment Setup (First Time Only)

Install dependency packages from pyproject.toml.

uv pip install --requirement pyproject.toml

3. Add schema='test' to Model

Add schema='test' to target model's config.

Always add at the beginning to minimize comma diff.

{{
  config(
    schema='test',  -- <- Add this
    materialized='incremental',
    ...
  )
}}

This writes the model to the test schema.

4. Verification

Verify schema name with compile.

uv run dbt compile --select <model_name> --profiles-dir ~/.dbt --no-use-colors

Confirm output contains test schema.

5. dbt run Execution

  • YOU MUST: Get user permission before dbt run
  • YOU MUST: Confirm output schema is test
uv run dbt run --select <model_name> --profiles-dir ~/.dbt --no-use-colors

6. dbt test Execution

uv run dbt test --select <model_name> --profiles-dir ~/.dbt --no-use-colors

7. Pre-commit Work

Remove schema='test' before committing.

{{
  config(
    -- schema='test',  <- Remove
    materialized='incremental',
    ...
  )
}}

8. Cautions

  • NEVER: Do not commit with schema='test' included
  • NEVER: Do not run dbt run without schema='test' (production write risk)
  • YOU MUST: Verify with git diff that schema='test' is removed before commit

Comments

Markdown supported