Convert Vertica DDL to dbt models compatible with Snowflake...
Transform Vertica 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:
Do NOT begin manual conversion of tables or views. Vertica has partial SnowConvert AI support (tables and views only — stored procedures and functions are NOT supported). Before writing any dbt model for a table or view by hand:
- Run SnowConvert AI on the source DDL to produce Snowflake-compatible SQL.
- Use the
$dbt-migration-snowflakeskill to convert the SCAI output to dbt models.- 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-migrationskill for download links and full workflow.
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_visitsbecomespatient_visits.sql. Do not rename objects during migration unless explicitly requested by the user.
You are a database engineer working for a hospital system. You need to convert Vertica 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 Vertica 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: [schema].[object_name]
Source Platform: Vertica
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 Vertica [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| Vertica | Snowflake | Notes |
|---|---|---|
| INT/INTEGER/BIGINT/SMALLINT/TINYINT | Same | |
| NUMERIC/DECIMAL | Same | |
| FLOAT/REAL/DOUBLE PRECISION | FLOAT | |
| CHAR/VARCHAR | Same | |
| LONG VARCHAR | VARCHAR | |
| BINARY/VARBINARY/LONG VARBINARY | BINARY | |
| BOOLEAN | BOOLEAN | |
| DATE | DATE | |
| TIME/TIMETZ | TIME | |
| TIMESTAMP/TIMESTAMPTZ | TIMESTAMP/TIMESTAMP_TZ | |
| INTERVAL | VARCHAR | |
| UUID | VARCHAR |
-- Projections -> Remove (Snowflake auto-manages)
CREATE PROJECTION proj AS SELECT ... -> (remove entirely)
-- SEGMENTED BY -> CLUSTER BY
CREATE TABLE t (...) SEGMENTED BY HASH(id) ->
CREATE TABLE t (...) CLUSTER BY (id)
-- Flex tables -> VARIANT columns
CREATE FLEX TABLE t() -> CREATE TABLE t (data VARIANT)
-- Case sensitivity (Vertica folds to lowercase)
SELECT Col -> SELECT "Col" -- if case matters
-- ANY/ALL array predicates
col = ANY(ARRAY[1,2,3]) -> col IN (1,2,3)
col <> ALL(ARRAY[1,2,3]) -> col NOT IN (1,2,3)
| Vertica | Snowflake | Notes |
|---|---|---|
NVL(a, b) |
NVL(a, b) |
Same |
NVL2(a, b, c) |
IFF(a IS NOT NULL, b, c) |
|
COALESCE(...) |
COALESCE(...) |
Same |
NULLIF(a, b) |
NULLIF(a, b) |
Same |
DECODE(expr, ...) |
CASE expr WHEN ... END |
|
GETDATE() |
CURRENT_TIMESTAMP() |
|
SYSDATE |
CURRENT_TIMESTAMP() |
|
ADD_MONTHS(d, n) |
DATEADD('month', n, d) |
|
DATEDIFF(unit, d1, d2) |
DATEDIFF(unit, d1, d2) |
Same |
TO_CHAR(d, fmt) |
TO_CHAR(d, fmt) |
Same |
TO_DATE(s, fmt) |
TO_DATE(s, fmt) |
Same |
INSTR(str, search) |
POSITION(search IN str) |
|
SUBSTR(s, pos, len) |
SUBSTR(s, pos, len) |
Same |
REGEXP_LIKE(s, p) |
REGEXP_LIKE(s, p) |
Same |
LISTAGG(col, delim) |
LISTAGG(col, delim) |
Same |
SPLIT_PART(s, d, n) |
SPLIT_PART(s, d, n) |
Same |
| Database | Key Considerations |
|---|---|
| Vertica | Projections, flex tables, case sensitivity with quotes, ANY/ALL array predicates |
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.