Mssql To Snowflake Dbt Migration 标志

Mssql To Snowflake Dbt Migration

组织
AltimateAI
mssql-to-snowflake-dbt-migration

将 MS SQL Server 源代码(存储过程、视图、T-SQL 脚本)转换为面向 Snowflake 的 dbt 模型,采用先构建再验证一致性的流程、隔离 Schema 部署,并提供迁移仪表板。适用于以下情况:(1)用户表示“将这段 T-SQL 迁移到 Snowflake 上的 dbt”“端到端转换这些存储过程”或“将 <schema> 从 SQL Server 迁移到 Snowflake”;(2)源代码位于代码仓库中的 `.sql` 转储文件,或可通过可连接的 MS SQL 连接访问,并且 Snowflake 中有可用于一致性验证的源数据行(已复制、暂存或可导入);(3)目标是使用 Snowflake 适配器的 dbt 项目;(4)用户需要分层架构(Medallion 或 Data Vault 2.0)、经一致性验证的输出,以及隔离 Schema 部署。**对于不涉及跨引擎一致性验证、隔离部署或 T-SQL 特殊问题的一般 SQL 到 dbt 转换,优先使用 `migrating-sql-to-dbt`。**目标运行时间:≤10 个对象时不超过 7 分钟;耗时大致随对象数量线性增长。

Add to TypingMind

概览

发布者AltimateAI
代码仓库data-engineering-skills
技能名称mssql-to-snowflake-dbt-migration
星标数
133
复刻数
12
附带文件
7
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 7 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 AltimateAI 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Mssql To Snowflake Dbt Migration AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/AltimateAI/data-engineering-skills/tree/main/skills/dbt/mssql-to-snowflake-dbt-migration
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AltimateAI/data-engineering-skills.git /tmp/data-engineering-skills
mkdir -p .claude/skills
cp -r /tmp/data-engineering-skills/skills/dbt/mssql-to-snowflake-dbt-migration .claude/skills/mssql-to-snowflake-dbt-migration
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Mssql To Snowflake Dbt Migration,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Mssql To Snowflake Dbt Migration。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Mssql To Snowflake Dbt Migration 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

mssql-to-snowflake-dbt-migration

Pick architecture → inventory source → convert → confirm → build to isolated schema → parity → verify → dashboard.

When NOT to use this skill

  • Source is PostgreSQL / MySQL / Oracle / BigQuery (not T-SQL) → migrating-sql-to-dbt.
  • Target is not Snowflake → migrating-sql-to-dbt + the appropriate warehouse skills.
  • Just one T-SQL snippet with no isolated-deploy or parity requirement → migrating-sql-to-dbt.
  • Enhancing an existing dbt model → dbt-model-enhancement.

Prerequisites

bash
command -v altimate-code     # strongly preferred — carries MS SQL + Snowflake adapters and data-parity
command -v dbt               # required for the deploy phase
command -v git               # required

Must have:

  • A dbt project configured for Snowflake (dbt_project.yml + a working profiles.yml or env-var profile).
  • A Snowflake role with CREATE SCHEMA on the target database and USAGE on a warehouse. The skill writes to an isolated schema, not prod.
  • A dedicated migration target in profiles.yml with a schema: override (see Phase 5 Method 1). The skill refuses to deploy without it — the --vars '{target_schema: ...}' trick is a no-op on standard projects.
  • dbt_utils package installed (packages.yml + dbt deps) — the rewrite table recommends dbt_utils.generate_surrogate_key as the NULL-safe way to port T-SQL IDENTITY columns. If dbt_utils isn't installed, add it before Phase 2 or avoid the IDENTITY mapping.
  • Source access via one of:
    • altimate-code configured with an MS SQL connection (altimate-code providers), OR
    • A directory of .sql dumps already in the repo.
  • For parity: source rows must be readable from Snowflake — either replicated (Fivetran/Airbyte/pre-existing bronze), or landable via stage + COPY INTO. Phase 6 hard-stops if neither is true.

If altimate-code is unavailable AND no dump exists, stop and tell the user.

If dbt is not installed, Phase 5 cannot run — stop and tell the user.

Time budget

Target end-to-end runtime: ≤7 min (420s) for ≤10 objects; scales roughly linearly beyond that. Hard ceiling 10 min (600s). Per-phase caps (sum = 420s): Phase 0 ≤20s · Phase 1 ≤45s · Phase 2 ≤120s · Phase 3 ≤15s · Phase 4 ≤15s · Phase 5 ≤90s · Phase 6 ≤90s · Phase 7 ≤25s.

Inputs

  • Source: either (a) a reachable MS SQL connection, or (b) a repo path containing .sql dumps.
  • Target: dbt project root (default: pwd).
  • Scope: specific objects, a schema, or "all" (confirm if ambiguous).

Workflow

Phase 0 — Choose layering + initialise state (ask ONCE, ≤20s)

Ask the user:

Which layering should the Snowflake dbt project use? 1. Medallion (bronze → silver → gold) — recommended for most analytics workloads. 2. Data Vault 2.0 (hubs / links / satellites) — pick if the source is heavily normalized OLTP and auditability matters.

Default to Medallion if the user doesn't answer in one exchange.

Initialise the run state immediately after the layering decision — Phase 2's conversion step calls scripts/record_written.sh, which requires an active run. If init were deferred to Phase 4 (user confirmation), Phase 2's writes would either fail with "no current run" or write to a stale previous run that Phase 4's init_run.sh then overwrites with an empty manifest.

bash
scripts/init_run.sh <Medallion|DataVault> '<migrated_models_selector>' <dbt_root>

What it does (see scripts/init_run.sh):

  • Validates layering (Medallion or DataVault) and the selector before touching state.
  • Then source scripts/state.sh init — creates a fresh <run_id> directory under $(git rev-parse --git-dir)/skill/mssql_migration/<run_id>/.
  • Computes TS once and ISOLATED_SCHEMA_PREFIX="MIGRATION_${TS}"; all later scripts read these from state.
  • Persists REPO_ROOT, DBT_ROOT, TS, ISOLATED_SCHEMA_PREFIX, LAYERING, SCOPE_SELECTOR into state.

If an earlier attempt left stale state (e.g. you ran init_run.sh with the wrong layering, or interrupted a previous run), the next init_run.sh would refuse with a run is already active. Either reset:

bash
source scripts/state.sh reset
scripts/init_run.sh …     # retry

…or re-use the same run (if its state is still correct) and update only what changed via source scripts/state.sh set VAR VALUE.

The migrated-models selector can be refined in Phase 2 after inventory. Do NOT re-run init_run.sh — that would create a new <run_id>, truncate the written-files manifest, and regenerate TS + the schema prefix. Update the single value in place instead:

bash
source scripts/state.sh load
source scripts/state.sh set SCOPE_SELECTOR '<updated_selector>'

Phase 1 — Inventory source (≤45s)

Live MS SQL (via altimate-code): pass the prompt via file to avoid shell interpolation of DB/schema names (which may contain quotes):

bash
if command -v altimate-code >/dev/null 2>&1; then
  cat > /tmp/mssql-inv-prompt.txt <<'EOF'
List all tables, views, and stored procedures in <db>.<schema> on the
configured MS SQL connection. Return name, type, and row count.
EOF
  altimate-code run "$(cat /tmp/mssql-inv-prompt.txt)" \
    --yolo --output /tmp/mssql-inventory.md --dir "$(pwd)"
fi

Repo dump:

bash
find <path> -type f \( -name "*.sql" -o -name "*.SQL" \) | sort

Group by object type (table / view / proc) and print a short inventory. If scope is "all" and the count exceeds 20, ask the user once to narrow or confirm proceeding in one batch.

Phase 2 — Convert T-SQL to Snowflake dbt (≤120s for ≤10 objects)

For each object:

Medallion mapping

  • Source table → sources.yml entry + models/bronze/stg_<name>.sql (1:1, renamed columns, typed).
  • View / simple SELECT → models/silver/int_<name>.sql.
  • Stored procedure (reporting-style) → models/gold/<name>.sql, materialized table or incremental based on size.

Data Vault mapping

  • Business key → models/hubs/hub_<entity>.sql
  • Relationship → models/links/link_<a>_<b>.sql
  • Descriptive attributes → models/satellites/sat_<entity>.sql with load_date + record_source.

T-SQL → Snowflake rewrites — apply with care; silent-data-change traps are called out explicitly. These do NOT fit a single-token substitution:

T-SQLSnowflake / dbtNotes
GETDATE()CURRENT_TIMESTAMP()OK
ISNULL(a, b)COALESCE(a, b)OK
TOP nLIMIT nOK
[bracketed] identifiersdouble-quoted or bareOK
DATEADD(dd, n, d)DATEADD(day, n, d)OK
CONVERT(type, x) (2-arg)x::typeOK
CONVERT(type, x, style) with date/time style codeTO_CHAR(x, '<fmt>') / TO_DATE(x, '<fmt>') / TO_TIMESTAMP(x, '<fmt>') with explicit format modelTRAP: bare ::type loses the style. Map 112 → 'YYYYMMDD', 120 → 'YYYY-MM-DD HH24:MI:SS', etc. by hand. Never drop the style silently.
#temp tablesCTEs or ephemeral modelsOK
CROSS APPLY <table_fn>(a)lateral joinOK: CROSS JOIN LATERAL ... works in Snowflake.
CROSS APPLY (SELECT TOP 1 ... WHERE outer.key = ...) (correlated TOP-1)aggregated CTE + JOIN with QUALIFY ROW_NUMBER() OVER (PARTITION BY key ORDER BY ...) = 1TRAP: LATERAL FLATTEN only expands VARIANT / ARRAY and will NOT work here.
OUTER APPLY (SELECT ... WHERE outer.key = ...)aggregated CTE + LEFT JOIN (Snowflake has no LEFT JOIN LATERAL for subqueries)TRAP: same reason — rewrite as a derived table joined on the correlation key.
a + b on strings`a
CONCAT(a, b, ...)COALESCE(a::VARCHAR, '') || COALESCE(b::VARCHAR, '') || ...TRAP: T-SQL CONCAT treats NULL as '' AND implicitly stringifies non-string args; Snowflake CONCAT returns NULL on any NULL arg, and COALESCE(number, '') errors with "Numeric value '' is not recognized" because the fallback is a VARCHAR and the first arg is a NUMBER. Cast each arg to VARCHAR before COALESCE.
WHERE col = 'active' (SQL Server default collation is case-insensitive)WHERE LOWER(col) = 'active' or confirm data is already lowercased in bronzeTRAP: Snowflake is case-sensitive — 'Active' will not match 'active'. Audit WHERE / JOIN predicates on string columns.
int_col / int_colTRUNC(a / NULLIF(b, 0)) (default — matches T-SQL truncation + T-SQL error-on-zero becomes NULL, a deliberate change)TRAP: T-SQL int / int TRUNCATES (7/2 = 3) and ERRORS on zero divisor; Snowflake returns a decimal (3.5) and never errors. Defaulting to a::NUMERIC / NULLIF(b, 0) would silently change 3 → 3.5 across every migrated query. TRUNC() preserves truncation; NULLIF turns the error into NULL, which must be called out as a deliberate behavior change in the dashboard.
MERGE ... WHEN MATCHED THEN UPDATE WHEN NOT MATCHED THEN INSERTincremental model with unique_key + dedup + lookbackTRAP: Snowflake MERGE fails nondeterministically on duplicate source keys ("Duplicate row detected during DML action"), and a naive is_incremental() filter on updated_at > max(updated_at) drops late-arriving rows. Always: (1) dedup inside the model with QUALIFY ROW_NUMBER() OVER (PARTITION BY <unique_key> ORDER BY updated_at DESC) = 1, (2) include a lookback window in the is_incremental() filter (e.g. updated_at > (SELECT MAX(updated_at) - INTERVAL '2 days' FROM {{ this }})).
MERGE ... WHEN NOT MATCHED BY SOURCE THEN DELETEno direct equivalent — flag for the user. Options: snapshot-based deletes, delete+insert incremental strategy with a hard-delete CTE, or a post-hook DELETE.TRAP: standard incremental with unique_key loses deletions.
IDENTITY(1,1) columnsAUTOINCREMENT on CREATE TABLE, OR ROW_NUMBER() OVER (ORDER BY ...) in a model, OR a NULL-safe surrogate via {{ dbt_utils.generate_surrogate_key([...]) }}TRAP: dbt models don't own identity sequences. Do NOT hand-roll md5(concat(col1, col2, ...)) — Snowflake CONCAT returns NULL on any NULL arg, so a business key with one NULL part becomes NULL for many rows, and they all collide on the same hash. dbt_utils.generate_surrogate_key is NULL-safe (it coalesces each arg to '_dbt_utils_surrogate_key_null_' before hashing).
DATETIME (3.33ms precision)TIMESTAMP_NTZ(9)TRAP: reading legacy DATETIME with fractional-ms logic that assumed the 3.33ms rounding will drift. Cast and document.
cursor / WHILE loopset-based rewriteFlag if truly impossible — never port the cursor as-is.
EXEC sp_... dynamic SQLreject — ask userNever blindly convert.

Delegate the batch conversion when possible. Pass source + prompt via file for safety:

bash
if command -v altimate-code >/dev/null 2>&1; then
  cat > /tmp/mssql-conv-prompt.txt <<'EOF'
Convert these T-SQL files to Snowflake dbt models using <layering>
layering. Write them under models/. Apply the T-SQL→Snowflake rewrites
from the project convention, paying attention to the TRAP rows (CROSS
APPLY correlated TOP-1, CONCAT NULL semantics, case-insensitive
collation, int division, MERGE WHEN NOT MATCHED BY SOURCE, DATETIME
precision). Preserve business logic. List every file written.
EOF
  altimate-code run "$(cat /tmp/mssql-conv-prompt.txt)" \
    --yolo --output /tmp/mssql-convert.md --dir "$(pwd)"
fi

Fallback (altimate-code not installed): convert one object at a time, writing the dbt model file and its YAML entry, applying the rewrite table above. This is slow — flag it to the user and keep scope small.

Add a sources.yml entry for every raw table, and a minimal _models.yml with description, columns, and not_null/unique tests for keys.

Phase 3 — Compile check (≤15s)

Before asking the user to deploy, verify the converted code at least compiles:

bash
dbt deps >/dev/null 2>&1 || true
dbt parse
dbt compile --select <migrated_models>

Hard stop: if dbt compile fails, fix before Phase 4. Parity + the user's confirmation are meaningless on broken SQL.

Phase 4 — User confirmation (ask ONCE, ≤15s)

State was initialised in Phase 0 and populated through Phase 2 conversion. Here we only show the summary and ask for a go/no-go.

Before deploying, show:

  • Count of models to be built
  • Target Snowflake database and isolated schema prefix (e.g. <db>.MIGRATION_<ts> — note: if the project configures +schema: bronze/silver/gold, dbt's default generate_schema_name concatenates, so actual schemas will be MIGRATION_<ts>_BRONZE, ..._SILVER, etc. All start with the prefix.)
  • Materializations (view / table / incremental counts)
  • Compile status (PASS)
  • Any TRAP rewrites that were applied (list them — the user needs to know)

Ask:

Deploy these N models to schemas starting with <database>.MIGRATION_<ts> on Snowflake now? Parity will run after the build, in the same schemas.

Wait for an explicit yes. Default is NO — do not deploy on silence.

Phase 5 — Deploy to isolated schema (≤90s)

Both methods for schema isolation go through one script. The script runs dbt deps first, then dbt build with --select "$SCOPE_SELECTOR" (from state — guaranteed non-empty), then runs the manifest-based isolation check — all in one process so state is loaded exactly once:

bash
scripts/deploy_isolated.sh method1 [<non_prod_target>]   # recommended
# OR
scripts/deploy_isolated.sh method2 [<non_prod_target>]

Method 1 (recommended for standard projects): dedicated target in profiles.yml with schema: "{{ env_var('DBT_SCHEMA') }}". The script exports DBT_SCHEMA="${ISOLATED_SCHEMA_PREFIX}" from state, so the schema can never be empty — unlike the inline-shell form in previous rounds, where a missing preamble gave DBT_SCHEMA="" and silently landed in the default schema.

Method 2: custom generate_schema_name macro reading var('target_schema'). The script passes --vars "{target_schema: \"${ISOLATED_SCHEMA_PREFIX}\"}". Only use this if macros/get_custom_schema.sql (or equivalent) exists and reads the var — otherwise --vars is a no-op.

Isolation check — scripts/isolation_check.py. Called at the end of deploy_isolated.sh. The check:

  • Reads selected unique_ids from target/run_results.json — the unique_id key has been top-level since dbt 1.5, works on every supported version.
  • Looks up each node's relation_name in target/manifest.json (authoritative; relation_name is written at parse time on every supported version, including dbt 1.7 where run_results.json omits it).
  • Includes model., snapshot., and seed. — all three materialise schemas, all three can leak out of the isolated prefix.
  • Fail-closed on empty ISOLATED_SCHEMA_PREFIX (would otherwise match everything via schema.startswith('')).
  • Hard-stops if checked == 0 (silent-pass on an empty check is worse than any FAIL).
  • Hard-stops on any node whose schema doesn't start with the prefix.

Hard stop: if dbt build fails OR the isolation check fails, stop and report. Do not proceed to parity.

Phase 6 — Parity validation (≤90s) — MANDATORY HARD STOP

Parity runs after the build, against the real materialised relations. Dump the migrated relation_names via the script (which uses manifest.json for relation_name lookup — version-stable, works on dbt 1.7 where run_results.json omits relation_name):

bash
# Load state — state.sh populates SKILL_DIR (set at init_run.sh time)
# so we can call sibling scripts via an absolute path regardless of
# the current working directory.
# shellcheck disable=SC1091
source scripts/state.sh load
# shellcheck disable=SC1091
source scripts/state.sh validate ISOLATED_SCHEMA_PREFIX SKILL_DIR REPO_ROOT DBT_ROOT

cd "$REPO_ROOT/$DBT_ROOT"
python3 "$SKILL_DIR/scripts/parity_relations.py" > /tmp/mssql-migrated-relations.txt \
  || { echo "No migrated relations found — did Phase 5 build anything?"; exit 1; }

if command -v altimate-code >/dev/null 2>&1; then
  # Quoted heredoc + sed injection — safe against object names containing
  # $()/backticks. __PREFIX__ is a literal placeholder; sed interpolates
  # $ISOLATED_SCHEMA_PREFIX after the heredoc body is already fixed.
  cat > /tmp/mssql-parity-prompt.txt <<'EOF'
For each migrated dbt model whose relation_name is listed in
/tmp/mssql-migrated-relations.txt (these are the actual Snowflake
relations under schemas prefixed with __PREFIX__, including any
+schema suffixes like _BRONZE / _SILVER / _GOLD), run data-parity
against the source MS SQL object. Use engine-neutral checks: row counts,
per-column aggregate (count/sum/min/max/null-count where typed), and a
keyed-sample diff for 1000 random keys. Mark PASS/FAIL per object. Stop
on first FAIL and surface the row-level diff.
EOF
  sed -i.bak "s/__PREFIX__/${ISOLATED_SCHEMA_PREFIX}/g" /tmp/mssql-parity-prompt.txt \
    && rm -f /tmp/mssql-parity-prompt.txt.bak

  altimate-code run "$(cat /tmp/mssql-parity-prompt.txt)" \
    --yolo --output /tmp/parity.md --dir "$(pwd)"
fi

Fallback (no altimate-code): parity must be computed on one engine — Snowflake. HASH_AGG, IS NOT DISTINCT FROM, and FULL OUTER JOIN are not portable to MS SQL. The source rows must exist in Snowflake:

  1. Replicated into Snowflake (Fivetran/Airbyte/pre-existing bronze). Use the replicated relation as the "source side".
  2. Not yet in Snowflake. Stop and tell the user: parity needs both sides in one place; either (a) land the source into Snowflake first (temporary stage + COPY INTO), or (b) install altimate-code, which handles cross-engine compare natively. Do NOT fabricate a PASS and do NOT silently downgrade to a row-count-only check.

After the source side is in Snowflake, compare on Snowflake only. Use engine-neutral checks (hashes from two engines aren't comparable):

  • Row count equality on both sides.
  • Per-column aggregate check: COUNT(*), SUM(col) (numeric columns only), MIN(col), MAX(col), and null-count via COUNT_IF(col IS NULL). Do NOT use COUNT(*) FILTER (WHERE col IS NULL) — Snowflake does not support the SQL-standard FILTER (WHERE ...) clause on aggregates and the statement will error with a syntax error. COUNT_IF is the Snowflake-native equivalent; SUM(IFF(col IS NULL, 1, 0)) is another valid form.
  • Keyed-sample diff: pick 1000 random keys on the source side and verify every column matches on the Snowflake side.

If parity cannot be computed for an object, report it as "parity not verified" — not PASS.

Hard stop: any FAIL (or "parity not verified") blocks the dashboard from showing PASS. Report the failing objects and the diff.

Phase 7 — Commit + dashboard (≤25s)

During Phase 2 conversion, record every file written so staging can scope to pipeline-only paths (not the whole models/ directory — unrelated WIP must not land in the migration PR):

bash
scripts/record_written.sh models/bronze/stg_<name>.sql models/silver/int_<name>.sql ...

If delegating conversion to altimate-code, parse its "List every file written" output and pass those paths to record_written.sh.

Then stage + commit via one script that loads state, creates the branch migration/mssql-to-snowflake-${TS} (fails if it exists so re-runs can't collide), stages exactly the recorded paths, and writes the commit message via quoted heredoc + sed injection (so <scope> / <layering> / object names containing $ or backticks can't trigger shell expansion):

bash
scripts/stage.sh

Do not push unless the user asked for a PR.

Return exactly this dashboard:

# MS SQL → Snowflake dbt Migration Dashboard

Scope:        <N> objects (<N> tables, <N> views, <N> procs)
Layering:     <Medallion | Data Vault 2.0>
Target:       <db>.MIGRATION_<ts>*  (NOT prod)

## Conversion
Models created:   <N>  (bronze <n> / silver <n> / gold <n>)
                       (or hubs <n> / links <n> / sats <n>)
Sources defined:  <N>
Tests added:      <N>
TRAP rewrites:    <list of CROSS APPLY / CONCAT / collation / etc. applied>

## Deployment
dbt build:        PASS (<N> models, <N> tests, <seconds>s)
Objects landed:   <N> in <db>.MIGRATION_<ts>*  (verified via INFORMATION_SCHEMA)

## Parity
PASS:             <N> / <N>
FAIL:             <N>  (details above if any)
Not verified:     <N>  (source not in Snowflake; details above)

## Next steps
- <bullet — e.g. "Promote MIGRATION_<ts> → prod via CI once reviewed">
- <bullet — e.g. "Schedule gold models in Airflow DAG X">
- <bullet — e.g. "Review sat_customer: 2 columns inferred as VARIANT, confirm">

Anti-patterns (never apply)

  • Deploy to --target prod from this skill.
  • dbt build with no --select — rebuilds the whole project and breaks isolation.
  • Rely on --vars '{target_schema: ...}' without a custom generate_schema_name macro — it's a no-op.
  • Report a dashboard-level PASS without the INFORMATION_SCHEMA verification that objects actually landed.
  • Run parity before dbt build — the dbt side doesn't exist yet.
  • Compare HASH_AGG across MS SQL and Snowflake — hashes aren't portable.
  • Downgrade parity to "row count only" when deep parity isn't feasible. Report "not verified" instead of fabricating a PASS.
  • Map CROSS APPLY to LATERAL FLATTEN for anything other than VARIANT / ARRAY expansion.
  • Map T-SQL CONCAT directly to Snowflake CONCAT without the per-arg COALESCE wrapper.
  • Assume case-insensitive string comparisons in Snowflake.
  • Port cursor loops as WHILE loops.
  • Blindly convert EXEC sp_... dynamic SQL — ask the user.
  • Hand-roll HASH(*) — not valid Snowflake.
  • Use COUNT(*) FILTER (WHERE ...) — not valid Snowflake either. Use COUNT_IF(...).
  • Hand-roll md5(concat(business_keys)) for surrogate keys — Snowflake CONCAT returns NULL on any NULL arg, so NULL keys collide. Use dbt_utils.generate_surrogate_key([...]).
  • Default integer-division rewrite to a::NUMERIC / b without TRUNC and NULLIF — it silently changes T-SQL truncating 3 to 3.5.
  • Default MERGE rewrite to a plain incremental unique_key without a QUALIFY dedup and a lookback window — Snowflake MERGE fails nondeterministically on duplicate source keys, and the naive is_incremental() filter drops late-arriving rows.
  • Use a fixed branch name (migration/mssql-to-snowflake) — re-runs collide. Include TS.
  • Use git diff --cached --quiet <path> || git add <path> as a staging gate — the index is empty before git add, so this always passes and the path is never staged.
  • Use UNION where the T-SQL used UNION ALL or vice-versa.
  • Modify the MS SQL source (read-only).
  • Interpolate schema / object / SQL text into shell commands or git commit -m "..." — always use temp files or heredocs.

Non-goals

  • No permission grants on Snowflake (roles, warehouses, grants).
  • No MS SQL writes.
  • No PR open unless the user asks.
  • No promotion from MIGRATION_<ts> to prod — that's a separate flow.

Behavior contract

  • Never deploy without the user's explicit yes in Phase 4.
  • Never claim parity PASS without a passing data-parity output; report "not verified" if the compare can't be run.
  • Never deploy to prod — isolated schema only.
  • Never claim deployment to a schema with zero objects in INFORMATION_SCHEMA.
  • Never silently skip objects that failed to convert — surface them.
  • Never run dbt build without --select scoped to the migrated models.
  • Never interpolate schema / object / SQL text into shell commands.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Mssql To Snowflake Dbt Migration AI 技能有什么作用?

将 MS SQL Server 源代码(存储过程、视图、T-SQL 脚本)转换为面向 Snowflake 的 dbt 模型,采用先构建再验证一致性的流程、隔离 Schema 部署,并提供迁移仪表板。适用于以下情况:(1)用户表示“将这段 T-SQL 迁移到 Snowflake 上的 dbt”“端到端转换这些存储过程”或“将 <schema> 从 SQL Server 迁移到 Snowflake”;(2)源代码位于代码仓库中的 `.sql` 转储文件,或可通过可连接的 MS SQL 连接访问,并且 Snowflake 中有可用于一致性验证的源数据行(已复制、暂存或可导入);(3)目标是使用 Snowflake 适配器的 dbt 项目;(4)用户需要分层架构(Medallion 或 Data Vault 2.0)、经一致性验证的输出,以及隔离 Schema 部署。**对于不涉及跨引擎一致性验证、隔离部署或 T-SQL 特殊问题的一般 SQL 到 dbt 转换,优先使用 `migrating-sql-to-dbt`。**目标运行时间:≤10 个对象时不超过 7 分钟;耗时大致随对象数量线性增长。

为什么在 TypingMind 中使用 Mssql To Snowflake Dbt Migration?

因为您只需安装一次,就能搭配任何模型使用。Mssql To Snowflake Dbt Migration 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Mssql To Snowflake Dbt Migration?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/AltimateAI/data-engineering-skills/tree/main/skills/dbt/mssql-to-snowflake-dbt-migration。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Mssql To Snowflake Dbt Migration?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Mssql To Snowflake Dbt Migration 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Mssql To Snowflake Dbt Migration 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Mssql To Snowflake Dbt Migration AI 技能免费吗?

是的。AltimateAI 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇