All skills
dbt-labs avatar

/migrating-dbt-project-across-platforms

@2116bc1 official
by dbt Labsdbt-labs/dbt-agent-skills729 stars
62

Use when migrating a dbt project from one data platform or data warehouse to another (e.g., Snowflake to Databricks, Databricks to Snowflake) using dbt Fusion's real-time compilation to identify and fix SQL dialect differences.

Use this Skill: https://skilld.dev/gh/dbt-labs/dbt-agent-skills/migrating-dbt-project-across-platforms

This session only. Nothing lands on disk.

referencesswitching-targets.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Switching Targets to the Destination Platform

PROBLEM

After generating unit tests on the source platform, the dbt project needs to be pointed at the destination platform. This involves adding a new target output in profiles.yml, updating source definitions, and removing any platform-specific configuration keys.

SOLUTION

Step 1: Add a new target output in profiles.yml

Add a new output entry for the destination platform within the existing profile in ~/.dbt/profiles.yml, then set target: to point to it. Do not change the profile key in dbt_project.yml.

Example — migrating from Snowflake to Databricks:

my_project:
  target: databricks_dev  # Switch active target to the new output
  outputs:
    snowflake_dev:         # Original source target (keep for reference)
      type: snowflake
      account: "{{ env_var('SNOWFLAKE_ACCOUNT') }}"
      user: "{{ env_var('SNOWFLAKE_USER') }}"
      password: "{{ env_var('SNOWFLAKE_PASSWORD') }}"
      role: TRANSFORMER
      database: ANALYTICS
      warehouse: COMPUTE_WH
      schema: DEV
      threads: 4
    databricks_dev:        # New destination target
      type: databricks
      catalog: main
      schema: dev
      host: "{{ env_var('DATABRICKS_HOST') }}"
      http_path: "{{ env_var('DATABRICKS_HTTP_PATH') }}"
      token: "{{ env_var('DATABRICKS_TOKEN') }}"
      threads: 4

To switch back to the source, change target: back to snowflake_dev. Alternatively, use the --target flag to run against a specific target without changing the default: dbtf compile --target databricks_dev.

Step 2: Update source definitions

Source definitions in _sources.yml or tpch_sources.yml may reference platform-specific database and schema names. Update them to match the destination platform:

# Snowflake source
sources:
  - name: tpch
    database: snowflake_sample_data
    schema: tpch_sf1
    tables:
      - name: orders
      - name: lineitem

# Databricks equivalent (using catalog)
sources:
  - name: tpch
    database: samples    # catalog name in Databricks
    schema: tpch
    tables:
      - name: orders
      - name: lineitem

Key differences by platform:

  • Snowflake: Uses database.schema hierarchy
  • Databricks: Uses catalog.schema hierarchy (Unity Catalog) — the database key in dbt maps to the catalog
  • BigQuery: Uses project.dataset hierarchy — the database key maps to the GCP project

Step 3: Remove platform-specific configurations

Search for and update platform-specific config keys in dbt_project.yml and model files:

Snowflake-specific configs to remove/update:

  • +snowflake_warehouse — Remove or replace with target equivalent
  • +query_tag — Snowflake-specific, remove
  • +copy_grants — Snowflake-specific, remove
  • cluster_by — Snowflake cluster keys need conversion to destination platform equivalent

Databricks-specific configs to remove/update:

  • +file_format: delta — Remove (delta is default on Databricks, not applicable elsewhere)
  • +location_root — Databricks-specific, remove
  • tblproperties — Databricks-specific, remove or convert

General config considerations:

  • +materialized values are generally consistent across platforms
  • +tags are platform-agnostic and can be left as-is
  • +persist_docs behavior may vary — check destination platform support

Step 4: Verify connectivity

Run dbtf debug to confirm the destination platform connection works:

dbtf debug

CHALLENGES

Source data doesn't exist on destination platform

If the source data (e.g., snowflake_sample_data.tpch_sf1) doesn't exist on the destination platform:

  • Check if equivalent sample data is available (e.g., Databricks has samples.tpch in Unity Catalog)
  • If not, consider using dbt seeds to load a subset of the data
  • Update source definitions to point to wherever the data lives on the target

Accessing sample TPCH data across platforms

TPCH sample data is commonly available:

  • Snowflake: snowflake_sample_data.tpch_sf1
  • Databricks: samples.tpch (Unity Catalog)
  • BigQuery: Available as public dataset bigquery-public-data.tpch_sf1

Column names and types are generally consistent across platforms for TPCH data, but verify with a quick query.

Multiple environments

If the project uses multiple targets (dev, staging, prod), you only need to configure one target for migration testing. Use dev or a dedicated migration target. Production configuration can be finalized after the migration is validated.

Source: SKILL.md on GitHub

1 warning17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    This skill guides the migration of dbt projects between platforms using dbt Fusion. While it involves processing untrusted dbt project files and executing CLI commands, it includes strong safety guidelines to prevent credential exposure and ignore malicious instructions embedded in project data.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer6mo

    3/4 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 2116bc1. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated 4 weeks ago
user-invocable
false
metadata
{
  "author": "dbt-labs"
}
  • dbt
  • migration
  • snowflake
  • databricks
  • sql-dialect
  • data-warehouse
  • fusion
  • compilation

README badge

README badge for dbt-labs/dbt-agent-skills/migrating-dbt-project-across-platforms

Automates migration of dbt projects between data warehouses (e.g., Snowflake to Databricks) by using dbt Fusion's real-time compilation to identify and fix SQL dialect differences. The workflow iterates through Fusion's error logs to resolve incompatibilities, then validates the migration with unit tests generated on the source platform before switching targets.

Generated from the current SKILL.md.

Does this skill work with any data warehouse, or only specific platforms?
It works with any pair of data warehouses that dbt Fusion supports. The skill is designed for migrations like Snowflake to Databricks, Databricks to Snowflake, and similar cross-platform moves. Success depends on dbt Fusion's dialect conversion capabilities.
Is dbt Fusion required, or can I use standard dbt?
dbt Fusion is required. The skill relies on Fusion's real-time compilation and rich error diagnostics to identify and guide fixes for SQL dialect differences. Standard dbt does not provide this capability.
Do I need to write unit tests, or can I skip that step?
Unit tests are mandatory. The skill uses them to prove data correctness on the target platform. You must generate tests on the source platform before migration, targeting every leaf node model plus models with significant transformation logic.
What counts as 'migration complete'?
Migration is complete when dbtf compile finishes with 0 errors and 0 warnings on the target platform, all unit tests pass, and all models run successfully. The skill treats warnings as blockers—they must be resolved before proceeding.
Does this handle packages and platform-specific dependencies?
Yes. The skill guides you through removing or updating platform-specific packages (like spark_utils for Databricks) and config keys (like +file_format or +snowflake_warehouse) that don't apply to the target platform.

Generated from the current SKILL.md. These answers refresh after source changes.