/snowflake-dbt-migration:dbt-migration-db2from snowflake-dbt-migration
Converts IBM DB2 DDL views, tables, stored procedures into dbt models for Snowflake, including schema.yml generation with tests and documentation. Useful for migrating DB2 SQL to dbt best practices.
Ships in snowflake-dbt-migration. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Transform IBM DB2 DDL (views, tables, stored procedures) into production-quality dbt models compatible with Snowflake, maintaining the same business logic and data transformation steps while following dbt best practices.
Activate this skill when users ask about:
You are a database engineer working for a hospital system. You need to convert IBM DB2 DDL to equivalent dbt code compatible with Snowflake, maintaining the same business logic and data transformation steps while following dbt best practices.
I will provide you the DB2 DDL to convert.
The code will be executed by data engineers who are learning Snowflake and dbt.
Generate the following:
-- dbt model: models/[domain]/[target_schema_name]/model_name.sql
{{ config(materialized='view') }}
/* Original Object: [database].[schema].[object_name]
Source Platform: IBM DB2
Purpose: [brief description]
Conversion Notes: [key changes]
Description: [SQL logic description] */
WITH source_data AS (
SELECT
customer_id::INTEGER AS customer_id,
customer_name::VARCHAR(100) AS customer_name,
account_balance::NUMBER(18,2) AS account_balance,
created_date::TIMESTAMP_NTZ AS created_date
FROM {{ ref('upstream_model') }}
),
transformed_data AS (
SELECT
customer_id,
UPPER(customer_name)::VARCHAR(100) AS customer_name_upper,
account_balance,
created_date,
CURRENT_TIMESTAMP()::TIMESTAMP_NTZ AS loaded_at
FROM source_data
)
SELECT
customer_id,
customer_name_upper,
account_balance,
created_date,
loaded_at
FROM transformed_data
## models/[domain]/[target_schema_name]/_models.yml
version: 2
models:
- name: model_name
description: "Table description; converted from IBM DB2 [Original object name]"
columns:
- name: customer_id
description: "Primary key - unique customer identifier"
tests:
- unique
- not_null
- name: customer_name_upper
description: "Customer name in uppercase"
- name: account_balance
description: "Current account balance; Foreign key to OTHER_TABLE"
tests:
- relationships:
to: ref('OTHER_TABLE')
field: OTHER_TABLE_KEY
- name: created_date
description: "Date the customer record was created"
- name: loaded_at
description: "Timestamp when the record was loaded by dbt"
## dbt_project.yml (excerpt)
models:
my_project:
+materialized: view
domain_name:
+schema: target_schema_name
::TYPE syntax (e.g.,
column_name::VARCHAR(100), amount::NUMBER(18,2)) to ensure output matches expected data types| DB2 | Snowflake | Notes |
|---|---|---|
| INTEGER/INT | INTEGER | |
| BIGINT | BIGINT | |
| SMALLINT | SMALLINT | |
| DECIMAL/NUMERIC | DECIMAL | |
| REAL/FLOAT | FLOAT | |
| DOUBLE | DOUBLE | |
| CHAR/VARCHAR | Same | |
| CLOB | VARCHAR | Max 16MB |
| BLOB | BINARY | Max 8MB |
| DATE | DATE | |
| TIME | TIME | |
| TIMESTAMP | TIMESTAMP | |
| XML | VARIANT |
-- FETCH FIRST -> LIMIT
SELECT * FROM table FETCH FIRST 10 ROWS ONLY -> SELECT * FROM table LIMIT 10
-- CURRENT DATE/TIMESTAMP (no parentheses in DB2)
CURRENT DATE -> CURRENT_DATE()
CURRENT TIMESTAMP -> CURRENT_TIMESTAMP()
-- CONTINUE/EXIT handlers -> Exception handling
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION ... ->
EXCEPTION WHEN OTHER THEN ...
-- VALUES clause
VALUES (1, 'a'), (2, 'b') -> SELECT 1, 'a' UNION ALL SELECT 2, 'b'
| DB2 | Snowflake | Notes |
|---|---|---|
COALESCE(a, b) | COALESCE(a, b) | Same |
IFNULL(a, b) | IFNULL(a, b) | Same |
VALUE(a, b) | NVL(a, b) | |
NULLIF(a, b) | NULLIF(a, b) | Same |
SUBSTR(str, pos, len) | SUBSTR(str, pos, len) | Same |
TRIM(str) | TRIM(str) | Same |
UPPER/LOWER | Same | |
LENGTH(str) | LENGTH(str) | Same |
LOCATE(search, str) | POSITION(search IN str) | |
DECIMAL(val, p, s) | val::NUMBER(p, s) | |
INTEGER(val) | val::INTEGER | |
VARCHAR(val) | val::VARCHAR | |
DATE(val) | val::DATE | |
CURRENT DATE | CURRENT_DATE() | Add parentheses |
CURRENT TIMESTAMP | CURRENT_TIMESTAMP() | Add parentheses |
DAYS(d) | DATEDIFF('day', '0001-01-01', d) | Days since epoch |
YEAR/MONTH/DAY(d) | YEAR/MONTH/DAY(d) | Same |
| Database | Key Considerations |
|---|---|
| IBM DB2 | Inline SQL PL, FETCH FIRST, CONTINUE/EXIT handlers, compound statements |
Detailed syntax translation guides are available in the translation-references/ folder.
Copyright Notice: The translation reference documentation in this repository is derived from Snowflake SnowConvert Documentation and is © Copyright Snowflake Inc. All rights reserved. Used for reference purposes only.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub sfc-gh-dflippo/snowflake-dbt-demo --plugin snowflake-dbt-migration15 skills in this plugin
/dbt-architecturedbt project structure using medallion architecture (bronze/silver/gold layers). Use this skill when planning project organization, establishing folder structure, defining naming conventions, implementing layer-based configuration, or ensuring proper model dependencies and architectural patterns./dbt-migrateEntry point for dbt-native migration. Routes a request to convert source SQL (Oracle, SQL Server, Teradata, Snowflake, BigQuery, DB2, Hive, PostgreSQL, Redshift, Sybase, Vertica) into dbt models on Snowflake. Use when the user says dbt migrate, convert to dbt, migrate to dbt, or migrate this warehouse to dbt models./dbt-Other plugins' skills for the same job