migrating-sql-to-dbt
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "migrating-sql-to-dbt":https://skillpi.com/zh/skills/deepskill-59ea2b4452437034ed645da1e8adb885e4cc321c7eb06e3cb7c08ec4d7a8b628。安装前核对上游来源和版本:https://github.com/AltimateAI/data-engineering-skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
用于将传统 SQL 转换为模块化 dbt 模型。适用于将存储过程、视图或原始 SQL 文件迁移为 dbt 模型、任务中提到“迁移/转换/传统 SQL/转换为 dbt/现代化”的情形、将单体查询拆分为模块化层级(先识别项目约定)、以及将现有数据管道或 ETL 移植到 dbt 工作流。逐层检查现有模型/源并验证构建。
介绍来源: third_party · AltimateAI · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: migrating-sql-to-dbt
description: |
Converts legacy SQL to modular dbt models. Use when migrating SQL to dbt for:
(1) Converting stored procedures, views, or raw SQL files to dbt models
(2) Task mentions "migrate", "convert", "legacy SQL", "transform to dbt", or "modernize"
(3) Breaking monolithic queries into modular layers (discovers project conventions first)
(4) Porting existing data pipelines or ETL to dbt patterns
Checks for existing models/sources, builds and validates layer by layer.dbt Migration
Don't convert everything at once. Build and validate layer by layer.
Workflow
1. Analyze Legacy SQL
cat <legacy_sql_file>
Identify all tables referenced in the query.
2. Check What Already Exists
# Search for existing models/sources that reference the table
grep -r "<table_name>" models/ --include="*.sql" --include="*.yml"
find models/ -name "*.sql" | xargs grep -l "<table_name>"
For each table referenced in the legacy SQL:
- Check if an existing model already references this table
- Check if a source definition exists
- If neither exists, ask user: "Table X not found - should I create it as a source?"
Only proceed to intermediate/mart layers after all dependencies exist.
3. Create Missing Sources
# models/staging/sources.yml
version: 2
sources:
- name: raw_database
schema: raw_schema
tables:
- name: orders
description: Raw orders from source system
- name: customers
description: Raw customer records
4. Build Staging Layer
One staging model per source table. Follow existing project naming conventions.
Build before proceeding:
dbt build --select <staging_model>
5. Build Intermediate Layer (if needed)
Extract complex joins/logic into intermediate models.
Build incrementally:
dbt build --select <intermediate_model>
6. Build Mart Layer
Final business-facing model with aggregations.
7. Validate Migration
# Build entire lineage
dbt build --select +<final_model>
dbt show --select <final_model>
Migration Checklist
- [ ] All source tables identified and documented
- [ ] Sources.yml created with descriptions
- [ ] Staging models: 1:1 with sources, renamed columns
- [ ] Intermediate models: business logic extracted
- [ ] Mart models: final aggregations
- [ ] Each layer compiles successfully
- [ ] Each layer builds successfully
- [ ] Row counts match original (manual validation)
- [ ] Tests added for key constraints
Common Migration Patterns
- Nested subqueries → Separate models (staging → intermediate → mart)
- Temp tables → Ephemeral materialization
{{ config(materialized='ephemeral') }} - Hardcoded values → Variables
{{ var("name") }}
Anti-Patterns
- Converting entire legacy query to single dbt model
- Skipping the staging layer
- Not validating each layer before proceeding
- Keeping hardcoded values instead of using variables
- Not documenting business logic during migration
当前收录版本
0.0.1
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供完整的 SQL 到 dbt 迁移工作流
- 包含详细的检查清单和验证步骤
- 针对数据工程师的实际迁移痛点
亮点
- 触发词覆盖全面,包含多种关键词变体
- 适用场景描述清晰,边界明确
待提升项
-
缺少 When to Use 章节 原报告严重程度:轻微
文档结构完整但缺少明确的 When to Use 章节
改进建议:建议添加 When to Use 章节以增强文档规范性
亮点
- 工作流步骤清晰,包含端到端示例
- 提供了迁移检查清单和常见模式
- frontmatter 完整,结构组织良好
亮点
- 提供具体的 dbt 命令示例
- 包含逐层验证机制
- 覆盖主要异常情况和反模式提醒
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。