Loading...
Loading...
Translates Snowflake dbt SQL models to Standardized BigQuery SQL. Handles SQL compilation, Jinja macro placeholder masking, BigQuery Translation Service migration workflows, AST-based config transformations, explicit type casting, JSON extraction standardization, and deduplication. Use when migrating Snowflake dbt pipelines or models to Google Cloud BigQuery. Don't use for generic BigQuery queries or non-Snowflake SQL migrations.
npx skill4agent add google/skills dbt-sf-to-bq-translatorQUALIFY_extracted_atmigration_plan/[mig_prefix]/tasks.mdgcloud auth login
gcloud auth application-default logingcloud config set project {project_id}gcloud services enable bigquerymigration.googleapis.com storage.googleapis.com bigquery.googleapis.comus-central1usgcloud config set compute/region us-central1mig_prefixmy_migration_projectuseu.zipcolumns.csvtables.csvmigration_plan/[mig_prefix]/tasks.mdscripts/bulk_translate_via_gcloud.pypython3 scripts/bulk_translate_via_gcloud.py \
--input <input_dir> \
--output <output_dir> \
--bucket <gcs_bucket> \
--location <region> \
[--metadata <metadata_path>]scripts/scripts/bulk_translate_via_gcloud.pyscripts/dbt_translator.pyconfig(...).sql{{ config(...) }}{{ source('src_name', 'table_name') }}_DBT_SOURCE_src_name_DBTSEP_table_name_{{ ref('model_name') }}_DBT_REF_model_name_{{ ... }}columns.csvtables.csvmetadata.zipgcloud storage cp <staging_input_dir>/*.sql gs://[YOUR_BUCKET]/migration_input/migration_config.yamlsnowflakeDialectbigqueryDialectschemaPathmetadata.zipgcloud bq migration-workflows create --location=<region> --config-file=migration_config.yaml --no-asyncgcloud storage cp gs://[YOUR_BUCKET]/migration_output/*.sql <translated_output_dir>/{{ config(...) }}copy_grantstransientsecurepre_hookpost_hookALTER ICEBERG TABLE ... REFRESHUNSET SECURE{{ ref(...) }}{{ source(...) }}{{ ... }}::datedateaddto_date::dateCAST(... AS DATE)::timestampCAST(... AS TIMESTAMP)dateadd(...)- interval '5 month'.yml.yaml# Copyright 2026 Google. This software is provided as-is, without warranty or
# representation for any use or purpose. Your use of it is subject to your
# agreement with Google.JSON_VALUECAST(JSON_EXTRACT_SCALAR(json_column, '$.path') AS TYPE)AS INT64NUMERICAS BOOLAS STRINGNULLIFAS TIMESTAMPCASTAS STRINGINT64ticket_iduser_idCAST(NULL AS TYPE)LEFT(col, length)SUBSTR(col, 1, length)LOWER(col) LIKE '%pattern%'REGEXP_CONTAINSDATE_ADD(CAST(col AS DATETIME), INTERVAL num HOUR)row_number() over (partition by [PRIMARY_KEY] order by [TIMESTAMP] desc) as rnqualify rn = 1LEFT JOINexploded_array{{ config(...) }}{{ ref(...) }}{{ source(...) }}{% if is_incremental() %}migration_plan/[mig_prefix]/translated_models/