dbt-sf-to-bq-translator

Translates Snowflake dbt SQL models to BigQuery SQL with automated dialect conversion and compliance standardization.

23.7k|2.0k|Updated Mar 31, 2026
Ready to run
npx skills add https://github.com/google/skills --skill dbt-sf-to-bq-translator-google
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: dbt-sf-to-bq-translator
Source: https://github.com/google/skills/tree/main/skills/cloud/dbt-sf-to-bq-translator
Command: npx skills add https://github.com/google/skills --skill dbt-sf-to-bq-translator-google

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pyyaml, and includes scripts (resource) and references (resource) components.

What problem does it solve? Migrating dbt pipelines from Snowflake to BigQuery requires rewriting hundreds of SQL models to handle dialect differences, semi-structured data access patterns, and type systems. Manual translation is error-prone and time-consuming, blocking teams from cloud migrations. ## Core Features & Use Cases - Automated SQL Dialect Translation: Converts Snowflake-specific syntax (colon notation, cast suffixes, dateadd functions) to BigQuery Standard SQL using the BigQuery Migration Service. - dbt Macro Preservation: Maintains {{ ref(...) }}, {{ source(...) }}, and Jinja control flow while translating underlying SQL. - JSON/STRUCT Standardization: Automatically converts Snowflake variant access patterns to BigQuery JSON_VALUE, dot notation for STRUCT columns, and ARRAY<STRUCT> indexing. - Use Case: You have a 50-model Snowflake dbt project using variant columns and nested object access. Run this Skill to generate BigQuery-compatible models with proper type casting, JSON extraction patterns, and deduplication logic in minutes instead of weeks. ## Quick Start Translate your Snowflake dbt project by providing the input directory containing SQL models, the output directory for BigQuery files, a GCS bucket for staging, and your Google Cloud region.

Frequently Asked Questions about dbt-sf-to-bq-translator

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

FAQPage Schema
How do I translate Snowflake SQL models to BigQuery dbt?▼

Use the bulk_translate_via_gcloud.py script with your input directory, output directory, GCS bucket, and region. The Skill orchestrates pre-processing (macro masking), BigQuery Translation Service invocation, and post-processing (reference resolution, STRUCT conversion, type casting).

What Snowflake SQL patterns does this Skill handle?▼

Handles colon notation (col:field), cast suffixes (::date, ::float), dateadd functions, bracket object access (col['field']), JSON variant extraction, and untyped arrays (::array). Also preserves dbt Jinja macros and incremental logic.

Does it preserve dbt config blocks and Jinja logic?▼

Yes. The Skill extracts {{ config(...) }} headers, strips Snowflake-specific parameters like copy_grants, sanitizes post_hooks to remove invalid commands, and preserves {{ ref(...) }}, {{ source(...) }}, and {% if is_incremental() %} blocks.

How does it handle JSON and STRUCT columns in BigQuery?▼

For native STRUCT columns, it converts json_value calls to direct dot notation (col.field). For JSON columns, it uses json_value with JSONPath. For ARRAY<STRUCT>, it uses SAFE_OFFSET indexing or TO_JSON wrapping depending on context.

What happens with untyped ARRAY<JSON> casts from Snowflake?▼

By default, BQMS converts ::array to ARRAY<JSON>. The Skill allows customization via --array-cast-mode to convert to ARRAY<STRING>, STRING, or json_extract_string_array depending on your source schema.

Does it handle error_unimplemented and 16MB substr wrappers?▼

Yes. The post-processing phase automatically replaces BQMS error_unimplemented markers with dot notation for STRUCT columns or json_value for JSON columns, and removes 16MB substr(string(...), 1, 16777216) wrappers with clean CAST expressions.