/snowflake-dbt-migration:dbt-migration-redshiftfrom snowflake-dbt-migration
Converts Amazon Redshift DDL (views, tables, stored procedures) into dbt models compatible with Snowflake, generating schema.yml files with tests and documentation.
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 Amazon Redshift 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 Amazon Redshift 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 Redshift 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: Amazon Redshift
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,
-- TIMESTAMPTZ converted to TIMESTAMP_TZ
created_date::TIMESTAMP_TZ 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 Amazon Redshift [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| Redshift | Snowflake | Notes |
|---|---|---|
| INT/INT2/INT4/INT8/INTEGER/BIGINT | Same | All alias to NUMBER |
| SMALLINT | SMALLINT | |
| DECIMAL/NUMERIC | Same | |
| FLOAT/FLOAT4/FLOAT8/REAL | FLOAT | |
| BOOL/BOOLEAN | BOOLEAN | |
| CHAR/VARCHAR/TEXT | Same | VARCHAR(MAX) → VARCHAR |
| BPCHAR | VARCHAR | |
| BINARY/VARBINARY/VARBYTE | BINARY | Max 8MB (vs 16MB Redshift) |
| DATE | DATE | |
| TIME/TIMETZ | TIME | Time zone not supported |
| TIMESTAMP/TIMESTAMPTZ | TIMESTAMP/TIMESTAMP_TZ | |
| INTERVAL types | VARCHAR | |
| GEOMETRY/GEOGRAPHY | Same | |
| SUPER | VARIANT | |
| HLLSKETCH | Not supported | Use HLL functions |
-- DISTKEY/SORTKEY → Remove (use clustering keys)
CREATE TABLE t (id INT) DISTKEY(id) SORTKEY(created_at) →
CREATE TABLE t (id INT) CLUSTER BY (created_at)
-- COPY/UNLOAD → COPY INTO
COPY table FROM 's3://bucket/path' IAM_ROLE 'arn:...' →
COPY INTO table FROM @stage/path
-- System catalogs
pg_catalog.pg_tables → INFORMATION_SCHEMA.TABLES
stl_query → QUERY_HISTORY table function
stv_sessions → SHOW SESSIONS
-- GETDATE() → CURRENT_TIMESTAMP
GETDATE() → CURRENT_TIMESTAMP()
-- NVL → COALESCE
NVL(col, 0) → COALESCE(col, 0)
-- LISTAGG
LISTAGG(col, ',') WITHIN GROUP (ORDER BY col) →
LISTAGG(col, ',') WITHIN GROUP (ORDER BY col)
-- APPROXIMATE COUNT DISTINCT
APPROXIMATE COUNT(DISTINCT col) → APPROX_COUNT_DISTINCT(col)
| Redshift | Snowflake | Notes |
|---|---|---|
NVL(a, b) | NVL(a, b) or COALESCE(a, b) | Same |
NVL2(a, b, c) | IFF(a IS NOT NULL, b, c) | |
COALESCE(...) | COALESCE(...) | Same |
NULLIF(a, b) | NULLIF(a, b) | Same |
GETDATE() | CURRENT_TIMESTAMP() | |
SYSDATE | CURRENT_DATE() | |
DATEADD(unit, n, d) | DATEADD(unit, n, d) | Same |
DATEDIFF(unit, d1, d2) | DATEDIFF(unit, d1, d2) | Same |
DATE_TRUNC(unit, d) | DATE_TRUNC(unit, d) | Same |
EXTRACT(part FROM d) | EXTRACT(part FROM d) | Same |
TO_CHAR(d, fmt) | TO_CHAR(d, fmt) | Same |
CONVERT(type, val) | val::type | |
LEN(str) | LENGTH(str) | |
CHARINDEX(s, str) | POSITION(s IN str) | |
LISTAGG(col, delim) | LISTAGG(col, delim) | Same |
APPROXIMATE COUNT(DISTINCT) | APPROX_COUNT_DISTINCT() | |
JSON_EXTRACT_PATH_TEXT() | JSON_EXTRACT_PATH_TEXT() | Same |
| Database | Key Considerations |
|---|---|
| Amazon Redshift | DISTKEY/SORTKEY, PL/pgSQL procedures, system catalogs (pg_, stl_, stv_), COPY/UNLOAD |
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
15 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-npx claudepluginhub sfc-gh-dflippo/snowflake-dbt-demo --plugin snowflake-dbt-migrationOther plugins' skills for the same job