Sybase IQ to dbt Model Conversion
Purpose
Transform Sybase IQ 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 Sybase IQ views or tables to dbt models
- Migrating Sybase stored procedures to dbt
- Translating Sybase SQL syntax to Snowflake
- Generating schema.yml files with tests and documentation
- Handling Sybase-specific syntax conversions (T-SQL variant, built-in functions)
Task Description
You are a database engineer working for a hospital system. You need to convert Sybase IQ 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 Sybase DDL to convert.
Audience
The code will be executed by data engineers who are learning Snowflake and dbt.
Output Requirements
Generate the following:
- One or more dbt models with complete SQL for every column
- A corresponding schema.yml file with appropriate tests and documentation
- A config block with materialization strategy
- Explanation of key changes and architectural decisions
- 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].[owner].[object_name]
Source Platform: Sybase IQ
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,
-- MONEY converted to NUMBER(18,2)
account_balance::NUMBER(18,2) AS account_balance,
-- DATETIME converted to TIMESTAMP_NTZ
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 Sybase IQ [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
Specific Translation Rules
dbt Specific Requirements
- If the source is a view, use a view materialization in dbt
- Include appropriate dbt model configuration (materialization type)
- Add documentation blocks for a schema.yml
- Add descriptions for tables and columns
- Include relevant tests
- Define primary keys and relationships
- Assume that upstream objects are models
- Comprehensively provide all the columns in the output
- Break complex procedures into multiple models if needed
- Implement appropriate incremental strategies for large tables
- Use Snowflake SQL functions rather than macros whenever possible
- Always cast columns with explicit precision/scale using
::TYPE syntax (e.g.,
column_name::VARCHAR(100), amount::NUMBER(18,2)) to ensure output matches expected data types
- Always provide explicit column aliases for clarity and documentation
Performance Optimization
- Suggest clustering keys if needed
- Recommend materialization strategy (view vs table)
- Identify potential performance improvements
Sybase to Snowflake Syntax Conversion
- Convert T-SQL variant syntax to Snowflake
- Replace Sybase built-in functions with Snowflake equivalents
- Handle SELECT statement differences
- Convert data types specific to Sybase IQ
- Replace procedural code with Snowflake Scripting
- Handle CASE expression differences
- Convert string functions
Key Data Type Mappings
| Sybase IQ |
Snowflake |
Notes |
| INT/INTEGER |
INTEGER |
|
| BIGINT |
BIGINT |
|
| SMALLINT/TINYINT |
Same |
|
| DECIMAL/NUMERIC |
Same |
|
| FLOAT/REAL/DOUBLE |
FLOAT |
|
| CHAR/VARCHAR |
Same |
|
| TEXT |
VARCHAR |
|
| BINARY/VARBINARY |
BINARY |
|
| BIT |
BOOLEAN |
|
| DATE |
DATE |
|
| TIME |
TIME |
|
| DATETIME/TIMESTAMP |
TIMESTAMP |
|
| MONEY/SMALLMONEY |
NUMBER(38,4) |
|
Key Syntax Conversions
-- TOP -> LIMIT
SELECT TOP 10 * FROM table -> SELECT * FROM table LIMIT 10
-- GETDATE() -> CURRENT_TIMESTAMP
GETDATE() -> CURRENT_TIMESTAMP()
-- ISNULL -> COALESCE
ISNULL(col, 0) -> COALESCE(col, 0)
-- CONVERT -> :: casting or TO_* functions
CONVERT(VARCHAR, col) -> col::VARCHAR
CONVERT(VARCHAR(50), col) -> col::VARCHAR(50)
CONVERT(DATE, col, 101) -> TO_DATE(col, 'MM/DD/YYYY')
-- String functions
CHARINDEX('x', col) -> POSITION('x' IN col)
Common Function Mappings
| Sybase IQ |
Snowflake |
Notes |
ISNULL(a, b) |
COALESCE(a, b) or IFNULL(a, b) |
|
COALESCE(...) |
COALESCE(...) |
Same |
NULLIF(a, b) |
NULLIF(a, b) |
Same |
GETDATE() |
CURRENT_TIMESTAMP() |
|
DATEADD(unit, n, d) |
DATEADD(unit, n, d) |
Same |
DATEDIFF(unit, d1, d2) |
DATEDIFF(unit, d1, d2) |
Same |
DATEPART(unit, d) |
DATE_PART(unit, d) |
|
CONVERT(type, val) |
val::type |
|
CAST(val AS type) |
val::type |
|
CHARINDEX(s, str) |
POSITION(s IN str) |
|
SUBSTRING(s, pos, len) |
SUBSTR(s, pos, len) |
|
LEN(str) |
LENGTH(str) |
|
REPLICATE(str, n) |
REPEAT(str, n) |
|
STUFF(s, pos, len, new) |
INSERT(s, pos, len, new) |
|
ROUND(n, d) |
ROUND(n, d) |
Same |
CEILING(n) |
CEIL(n) |
|
Dependencies
- List any upstream dependencies
- Suggest model organization in dbt project
Validation Checklist
- [] Every DDL statement has been accounted for in the dbt models
- [] SQL in models is compatible with Snowflake
- [] Sybase-specific syntax converted (T-SQL variant functions, SELECT differences)
- [] All business logic preserved
- [] All columns included in output
- [] Data types correctly mapped
- [] Functions translated to Snowflake equivalents
- [] Materialization strategy selected
- [] Tests added
- [] SQL logic description complete
- [] Table descriptions added
- [] Column descriptions added
- [] Dependencies correctly mapped
- [] Incremental logic (if applicable) verified
- [] Inline comments added for converted syntax
Related Skills
- $dbt-migration - For the complete migration workflow (discovery, planning, placeholder models,
testing, deployment)
- $dbt-modeling - For CTE patterns and SQL structure guidance
- $dbt-testing - For implementing comprehensive dbt tests
- $dbt-architecture - For project organization and folder structure
- $dbt-materializations - For choosing materialization strategies (view, table, incremental,
snapshots)
- $dbt-performance - For clustering keys, warehouse sizing, and query optimization
- $dbt-commands - For running dbt commands and model selection syntax
- $dbt-core - For dbt installation, configuration, and package management
- $snowflake-cli - For executing SQL and managing Snowflake objects
Supported Source Database
| Database |
Key Considerations |
| Sybase IQ |
T-SQL variant, different built-in functions, SELECT syntax differences |
Translation References
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.
Reference Index
- Built In Functions
- Create Table
- Create View
- Data Types
- Overview (README)
- Select Statement
- Subqueries
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: dbt-migration-sybase3description: Transform Sybase IQ DDL (views, tables, stored procedures) into production-quality dbt models Use when this capability is needed.4---56# Sybase IQ to dbt Model Conversion78## Purpose910Transform Sybase IQ DDL (views, tables, stored procedures) into production-quality dbt models11compatible with Snowflake, maintaining the same business logic and data transformation steps while12following dbt best practices.1314## When to Use This Skill1516Activate this skill when users ask about:1718- Converting Sybase IQ views or tables to dbt models19- Migrating Sybase stored procedures to dbt20- Translating Sybase SQL syntax to Snowflake21- Generating schema.yml files with tests and documentation22- Handling Sybase-specific syntax conversions (T-SQL variant, built-in functions)2324---2526## Task Description2728You are a database engineer working for a hospital system. You need to convert Sybase IQ DDL to29equivalent dbt code compatible with Snowflake, maintaining the same business logic and data30transformation steps while following dbt best practices.3132## Input Requirements3334I will provide you the Sybase DDL to convert.3536## Audience3738The code will be executed by data engineers who are learning Snowflake and dbt.3940## Output Requirements4142Generate the following:43441. One or more dbt models with complete SQL for every column452. A corresponding schema.yml file with appropriate tests and documentation463. A config block with materialization strategy474. Explanation of key changes and architectural decisions485. Inline comments highlighting any syntax that was converted4950## Conversion Guidelines5152### General Principles5354- Replace procedural logic with declarative SQL where possible55- Break down complex procedures into multiple modular dbt models56- Implement appropriate incremental processing strategies57- Maintain data quality checks through dbt tests58- Use Snowflake SQL functions rather than macros whenever possible5960### Sample Response Format6162```sql63-- dbt model: models/[domain]/[target_schema_name]/model_name.sql64{{ config(materialized='view') }}6566/* Original Object: [database].[owner].[object_name]67 Source Platform: Sybase IQ68 Purpose: [brief description]69 Conversion Notes: [key changes]70 Description: [SQL logic description] */7172WITH source_data AS (73 SELECT74 customer_id::INTEGER AS customer_id,75 customer_name::VARCHAR(100) AS customer_name,76 -- MONEY converted to NUMBER(18,2)77 account_balance::NUMBER(18,2) AS account_balance,78 -- DATETIME converted to TIMESTAMP_NTZ79 created_date::TIMESTAMP_NTZ AS created_date80 FROM {{ ref('upstream_model') }}81),8283transformed_data AS (84 SELECT85 customer_id,86 UPPER(customer_name)::VARCHAR(100) AS customer_name_upper,87 account_balance,88 created_date,89 CURRENT_TIMESTAMP()::TIMESTAMP_NTZ AS loaded_at90 FROM source_data91)9293SELECT94 customer_id,95 customer_name_upper,96 account_balance,97 created_date,98 loaded_at99FROM transformed_data100```101102```yaml103## models/[domain]/[target_schema_name]/_models.yml104version: 2105106models:107 - name: model_name108 description: "Table description; converted from Sybase IQ [Original object name]"109 columns:110 - name: customer_id111 description: "Primary key - unique customer identifier"112 tests:113 - unique114 - not_null115 - name: customer_name_upper116 description: "Customer name in uppercase"117 - name: account_balance118 description: "Current account balance; Foreign key to OTHER_TABLE"119 tests:120 - relationships:121 to: ref('OTHER_TABLE')122 field: OTHER_TABLE_KEY123 - name: created_date124 description: "Date the customer record was created"125 - name: loaded_at126 description: "Timestamp when the record was loaded by dbt"127```128129```yaml130## dbt_project.yml (excerpt)131models:132 my_project:133 +materialized: view134 domain_name:135 +schema: target_schema_name136```137138### Specific Translation Rules139140#### dbt Specific Requirements141142- If the source is a view, use a view materialization in dbt143- Include appropriate dbt model configuration (materialization type)144- Add documentation blocks for a schema.yml145- Add descriptions for tables and columns146- Include relevant tests147- Define primary keys and relationships148- Assume that upstream objects are models149- Comprehensively provide all the columns in the output150- Break complex procedures into multiple models if needed151- Implement appropriate incremental strategies for large tables152- Use Snowflake SQL functions rather than macros whenever possible153- **Always cast columns with explicit precision/scale** using `::TYPE` syntax (e.g.,154 `column_name::VARCHAR(100)`, `amount::NUMBER(18,2)`) to ensure output matches expected data types155- **Always provide explicit column aliases** for clarity and documentation156157#### Performance Optimization158159- Suggest clustering keys if needed160- Recommend materialization strategy (view vs table)161- Identify potential performance improvements162163#### Sybase to Snowflake Syntax Conversion164165- Convert T-SQL variant syntax to Snowflake166- Replace Sybase built-in functions with Snowflake equivalents167- Handle SELECT statement differences168- Convert data types specific to Sybase IQ169- Replace procedural code with Snowflake Scripting170- Handle CASE expression differences171- Convert string functions172173#### Key Data Type Mappings174175| Sybase IQ | Snowflake | Notes |176| ------------------ | ------------ | ----- |177| INT/INTEGER | INTEGER | |178| BIGINT | BIGINT | |179| SMALLINT/TINYINT | Same | |180| DECIMAL/NUMERIC | Same | |181| FLOAT/REAL/DOUBLE | FLOAT | |182| CHAR/VARCHAR | Same | |183| TEXT | VARCHAR | |184| BINARY/VARBINARY | BINARY | |185| BIT | BOOLEAN | |186| DATE | DATE | |187| TIME | TIME | |188| DATETIME/TIMESTAMP | TIMESTAMP | |189| MONEY/SMALLMONEY | NUMBER(38,4) | |190191#### Key Syntax Conversions192193```sql194-- TOP -> LIMIT195SELECT TOP 10 * FROM table -> SELECT * FROM table LIMIT 10196197-- GETDATE() -> CURRENT_TIMESTAMP198GETDATE() -> CURRENT_TIMESTAMP()199200-- ISNULL -> COALESCE201ISNULL(col, 0) -> COALESCE(col, 0)202203-- CONVERT -> :: casting or TO_* functions204CONVERT(VARCHAR, col) -> col::VARCHAR205CONVERT(VARCHAR(50), col) -> col::VARCHAR(50)206CONVERT(DATE, col, 101) -> TO_DATE(col, 'MM/DD/YYYY')207208-- String functions209CHARINDEX('x', col) -> POSITION('x' IN col)210```211212#### Common Function Mappings213214| Sybase IQ | Snowflake | Notes |215| ------------------------- | ---------------------------------- | ----- |216| `ISNULL(a, b)` | `COALESCE(a, b)` or `IFNULL(a, b)` | |217| `COALESCE(...)` | `COALESCE(...)` | Same |218| `NULLIF(a, b)` | `NULLIF(a, b)` | Same |219| `GETDATE()` | `CURRENT_TIMESTAMP()` | |220| `DATEADD(unit, n, d)` | `DATEADD(unit, n, d)` | Same |221| `DATEDIFF(unit, d1, d2)` | `DATEDIFF(unit, d1, d2)` | Same |222| `DATEPART(unit, d)` | `DATE_PART(unit, d)` | |223| `CONVERT(type, val)` | `val::type` | |224| `CAST(val AS type)` | `val::type` | |225| `CHARINDEX(s, str)` | `POSITION(s IN str)` | |226| `SUBSTRING(s, pos, len)` | `SUBSTR(s, pos, len)` | |227| `LEN(str)` | `LENGTH(str)` | |228| `REPLICATE(str, n)` | `REPEAT(str, n)` | |229| `STUFF(s, pos, len, new)` | `INSERT(s, pos, len, new)` | |230| `ROUND(n, d)` | `ROUND(n, d)` | Same |231| `CEILING(n)` | `CEIL(n)` | |232233#### Dependencies234235- List any upstream dependencies236- Suggest model organization in dbt project237238---239240## Validation Checklist241242- [] Every DDL statement has been accounted for in the dbt models243- [] SQL in models is compatible with Snowflake244- [] Sybase-specific syntax converted (T-SQL variant functions, SELECT differences)245- [] All business logic preserved246- [] All columns included in output247- [] Data types correctly mapped248- [] Functions translated to Snowflake equivalents249- [] Materialization strategy selected250- [] Tests added251- [] SQL logic description complete252- [] Table descriptions added253- [] Column descriptions added254- [] Dependencies correctly mapped255- [] Incremental logic (if applicable) verified256- [] Inline comments added for converted syntax257258---259260## Related Skills261262- $dbt-migration - For the complete migration workflow (discovery, planning, placeholder models,263 testing, deployment)264- $dbt-modeling - For CTE patterns and SQL structure guidance265- $dbt-testing - For implementing comprehensive dbt tests266- $dbt-architecture - For project organization and folder structure267- $dbt-materializations - For choosing materialization strategies (view, table, incremental,268 snapshots)269- $dbt-performance - For clustering keys, warehouse sizing, and query optimization270- $dbt-commands - For running dbt commands and model selection syntax271- $dbt-core - For dbt installation, configuration, and package management272- $snowflake-cli - For executing SQL and managing Snowflake objects273274---275276## Supported Source Database277278| Database | Key Considerations |279| ------------- | ---------------------------------------------------------------------- |280| **Sybase IQ** | T-SQL variant, different built-in functions, SELECT syntax differences |281282## Translation References283284Detailed syntax translation guides are available in the `translation-references/` folder.285286> **Copyright Notice:** The translation reference documentation in this repository is derived from287> [Snowflake SnowConvert Documentation](https://docs.snowflake.com/en/migrations/snowconvert-docs)288> and is © Copyright Snowflake Inc. All rights reserved. Used for reference purposes only.289290### Reference Index291292- [Built In Functions](translation-references/sybase-built-in-functions.md)293- [Create Table](translation-references/sybase-create-table.md)294- [Create View](translation-references/sybase-create-view.md)295- [Data Types](translation-references/sybase-data-types.md)296- [Overview (README)](translation-references/sybase-readme.md)297- [Select Statement](translation-references/sybase-select-statement.md)298- [Subqueries](translation-references/sybase-subqueries.md)299300---301> Converted and distributed by [TomeVault](https://tomevault.io/claim/sfc-gh-dflippo) — claim your Tome and manage your conversions.302<!-- tomevault:4.0:skill_md:2026-04-11 -->