Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

dbt-migration-postgres

БесплатноБез исполняемых скриптовНе проверен

Convert PostgreSQL/Greenplum/Netezza DDL to dbt models compatible with Snowflake. This skill should be used when converting views, tables, or stored…

sfc-gh-dflippoот sfc-gh-dflippo★ 35 звёзд на GitHub

Об этом скилле

PostgreSQL/Greenplum/Netezza to dbt Model Conversion

Purpose

Transform PostgreSQL/Greenplum/Netezza 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.

When to Use This Skill

Activate this skill when users ask about:

  • Converting PostgreSQL/Greenplum/Netezza views or tables to dbt models
  • Migrating PostgreSQL stored procedures to dbt
  • Translating PostgreSQL syntax to Snowflake
  • Generating schema.yml files with tests and documentation
  • Handling PostgreSQL-specific syntax conversions (array expressions, CHAR padding, psql commands)

REQUIRED FIRST STEP — Run SnowConvert AI (SCAI)

Do NOT begin manual conversion of tables or views. PostgreSQL has partial SnowConvert AI support (tables and views only — procedures and functions are NOT supported). Before writing any dbt model for a table or view by hand:

  1. Run SnowConvert AI on the source DDL to produce Snowflake-compatible SQL.
  2. Use the $dbt-migration-snowflake skill to convert the SCAI output to dbt models.
  3. Only fall back to this skill's manual translation rules for objects SCAI could not convert (check the conversion report for EWIs) or for procedures/functions (which require manual conversion).

See the $dbt-migration skill for download links and full workflow.

Name Retention Rule

Preserve original object names. The dbt model filename and model name MUST match the original source object name (lowercased, without schema prefix). For example, public.patient_visits becomes patient_visits.sql. Do not rename objects during migration unless explicitly requested by the user.


Task Description

You are a database engineer working for a hospital system. You need to convert PostgreSQL/Greenplum/Netezza DDL to equivalent dbt code compatible with Snowflake, maintaining the same business logic and data transformation steps while following dbt best practices.

Input Requirements

I will provide you the PostgreSQL DDL to convert.

Audience

The code will be executed by data engineers who are learning Snowflake and dbt.

Output Requirements

Generate the following:

  1. One or more dbt models with complete SQL for every column
  2. A corresponding schema.yml file with appropriate tests and documentation
  3. A config block with materialization strategy
  4. Explanation of key changes and architectural decisions
  5. Inline comments highlighting any syntax that was converted

Conversion Guidelines

General Principles

  • Replace procedural logic with declarative SQL where possible
  • Break down complex procedures into multiple modular dbt models
  • Implement appropriate incremental processing strategies
  • Maintain data quality checks through dbt tests
  • Use Snowflake SQL functions rather than macros whenever possible

Sample Response Format

-- dbt model: models/[domain]/[target_schema_name]/model_name.sql
{{ config(materialized='view') }}

/* Original Object: [database].[schema].[object_name]
   Source Platform: PostgreSQL/Greenplum/Netezza
   Purpose: [brief description]
   Conversion Notes: [key changes]
   Description: [SQL logic description] */

WITH source_data AS (
    SELECT
        -- SERIAL converted to INTEGER (use IDENTITY in table)
        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 PostgreSQL [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
    domai
Полный SKILL.md на GitHub

Установить dbt-migration-postgres в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

translation-references/postgres-data-types-netezza-data-types.mdtranslation-references/postgres-data-types-postgresql-data-types.mdtranslation-references/postgres-ddls-create-materialized-view-greenplum-create-materialized-view.mdtranslation-references/postgres-ddls-create-materialized-view-postgresql-create-materialized-view.mdtranslation-references/postgres-ddls-create-table-greenplum-create-table.mdtranslation-references/postgres-ddls-create-table-netezza-create-table.mdtranslation-references/postgres-ddls-create-table-postgresql-create-table.mdtranslation-references/postgres-ddls-postgresql-create-view.mdtranslation-references/postgres-etl-bi-repointing-power-bi-postgres-repointing.mdtranslation-references/postgres-readme.mdtranslation-references/postgres-subqueries.mdtranslation-references/postgresql-built-in-functions.mdtranslation-references/postgresql-expressions.mdtranslation-references/postgresql-interactive-terminal.mdtranslation-references/postgresql-string-comparison.md

FAQ

Что делает скилл dbt-migration-postgres?

Convert PostgreSQL/Greenplum/Netezza DDL to dbt models compatible with Snowflake. This skill should be used when converting views, tables, or stored procedures from PostgreSQL, Greenplum, or Netezza to dbt code, generating schema.yml files with tests and documentation, or migrating PostgreSQL SQL to follow dbt best practices.

Как установить скилл dbt-migration-postgres?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл dbt-migration-postgres запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить dbt-migration-postgres с