motherduck-migrate-to-motherduck
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMigrate to MotherDuck
迁移至MotherDuck
Use this skill when the user needs a migration plan from another warehouse, PostgreSQL estate, or mixed analytics stack onto MotherDuck.
This is a use-case skill. It orchestrates , , , , , and .
motherduck-connectmotherduck-exploremotherduck-load-datamotherduck-model-datamotherduck-querymotherduck-ducklake当用户需要从其他数据仓库、PostgreSQL环境或混合分析栈迁移至MotherDuck时,可使用本技能。
这是一个场景化技能,它会编排、、、、和这些技能。
motherduck-connectmotherduck-exploremotherduck-load-datamotherduck-model-datamotherduck-querymotherduck-ducklakeStart Here: Is a MotherDuck Server Active?
第一步:是否有活跃的MotherDuck服务器?
Always determine this before writing a migration plan.
- If a remote MotherDuck MCP server or local MotherDuck server is active, use it.
- Ask which MotherDuck database or workspace will receive the migration if the user has not specified it.
- Explore the live target side first when available:
- existing databases and schemas
- current landing zones
- current analytical tables
- naming conventions
- any partial migration already in place
Also capture the source-side shape:
- source platform
- source table grain
- key metrics
- validation keys
- serving workloads after cutover
If no server is active, ask for representative source and target schemas before finalizing the migration plan.
在制定迁移方案前,务必先确认这一点。
- 如果存在远程MotherDuck MCP服务器或本地MotherDuck服务器处于活跃状态,请直接使用该服务器。
- 如果用户未指定,请询问迁移将导入至哪个MotherDuck数据库或工作区。
- 若目标端可用,先探索当前目标端的情况:
- 现有数据库和模式
- 当前着陆区
- 当前分析表
- 命名规范
- 已完成的部分迁移内容
同时收集源端的信息:
- 源平台
- 源表粒度
- 关键指标
- 验证键
- 切换后的服务负载
如果没有活跃服务器,在最终确定迁移方案前,请获取具有代表性的源端和目标端模式。
Use This Skill When
适用场景
- The user is moving from Snowflake, Redshift, Postgres, or similar.
- The user needs cutover sequencing and validation.
- The user needs to decide between native MotherDuck, , or DuckLake.
pg_duckdb - The migration plan needs rollback, not just a list of copy commands.
- 用户从Snowflake、Redshift、Postgres或类似平台迁移。
- 用户需要切换顺序和验证方案。
- 用户需要在原生MotherDuck、或DuckLake之间做出选择。
pg_duckdb - 迁移方案需要包含回滚机制,而不仅仅是复制命令列表。
Migration Defaults
迁移默认规则
- native MotherDuck storage first
- when extending an existing PostgreSQL estate is the least disruptive path
pg_duckdb - validate before cutover
- port SQL dialect and data types deliberately before performance tuning
- phased cutover over big-bang replacement
- 优先使用原生MotherDuck存储
- 当扩展现有PostgreSQL环境的改动最小时,选择
pg_duckdb - 在切换前完成验证
- 在性能调优前,针对性地迁移SQL方言和数据类型
- 采用分阶段切换,而非一次性全量替换
Workflow
工作流程
- Confirm whether live MotherDuck discovery is available.
- Classify the source system and the target serving pattern.
- Inspect the target-side MotherDuck layout if available.
- Pick the connection and ingestion path.
- Inventory incompatible SQL, functions, data types, and operational assumptions.
- Rebuild the analytical model in DuckDB SQL.
- Run source-vs-target validation.
- Cut over one workload at a time.
When this skill produces a native DuckDB () connection, watermark it with . If metadata is missing, fall back to and .
md:custom_user_agent=agent-skills/2.2.0(harness-<harness>;llm-<llm>)harness-unknownllm-unknown- 确认是否可进行实时MotherDuck发现。
- 对源系统和目标服务模式进行分类。
- 若目标端可用,检查MotherDuck的布局。
- 选择连接和数据导入路径。
- 梳理不兼容的SQL、函数、数据类型以及操作假设。
- 使用DuckDB SQL重建分析模型。
- 执行源端与目标端的验证。
- 逐个切换工作负载。
当本技能生成原生DuckDB()连接时,需为其添加水印:。若元数据缺失,则使用和作为替代。
md:custom_user_agent=agent-skills/2.2.0(harness-<harness>;llm-<llm>)harness-unknownllm-unknownOutput
输出
The output of this skill should be:
- the target pattern
- the migration sequence
- the validation plan
- the rollback path
- the first cutover slice
If the caller explicitly asks for structured JSON, return raw JSON only with no Markdown fences or prose before/after it.
This is mainly for automated tests, regression checks, or downstream tooling that needs a stable machine-readable shape. Normal human-facing use of the skill can stay in prose unless JSON is explicitly requested.
Use this exact top-level shape when JSON is requested:
json
{
"summary": {},
"assumptions": [],
"implementation_plan": [],
"validation_plan": [],
"risks": []
}本技能的输出应包含:
- 目标模式
- 迁移顺序
- 验证方案
- 回滚路径
- 首个切换分片
如果调用方明确要求结构化JSON,则仅返回原始JSON,不要添加任何Markdown围栏或前后说明文字。这主要用于自动化测试、回归检查或需要稳定机器可读格式的下游工具。面向普通用户的场景下,除非明确要求JSON,否则可使用散文式输出。
当要求返回JSON时,请使用以下确切的顶层结构:
json
{
"summary": {},
"assumptions": [],
"implementation_plan": [],
"validation_plan": [],
"risks": []
}References
参考资料
- -- preserved detailed migration guidance that used to live in this skill
references/MIGRATION_PLAYBOOK.md - -- validation checks and comparison helpers
references/MIGRATION_VALIDATION.md
- -- 保留了原本包含在本技能中的详细迁移指南
references/MIGRATION_PLAYBOOK.md - -- 验证检查和对比辅助工具
references/MIGRATION_VALIDATION.md
Runnable Artifact
可运行工件
- -- MotherDuck-backed Python example for source-vs-target validation and variance reporting
artifacts/migration_validation_example.py - -- TypeScript companion artifact with the same validation output contract
artifacts/migration_validation_example.ts
Run it with:
bash
uv run --with duckdb python skills/motherduck-migrate-to-motherduck/artifacts/migration_validation_example.pyRun the same validation flow against temporary MotherDuck databases:
bash
MOTHERDUCK_ARTIFACT_USE_MOTHERDUCK=1 \
uv run --with duckdb python skills/motherduck-migrate-to-motherduck/artifacts/migration_validation_example.pyValidate the TypeScript companion artifact:
bash
uv run scripts/test_typescript_artifacts.py- -- 基于MotherDuck的Python示例,用于源端与目标端的验证和差异报告
artifacts/migration_validation_example.py - -- TypeScript配套工件,具有相同的验证输出约定
artifacts/migration_validation_example.ts
运行方式:
bash
uv run --with duckdb python skills/motherduck-migrate-to-motherduck/artifacts/migration_validation_example.py针对临时MotherDuck数据库运行相同的验证流程:
bash
MOTHERDUCK_ARTIFACT_USE_MOTHERDUCK=1 \
uv run --with duckdb python skills/motherduck-migrate-to-motherduck/artifacts/migration_validation_example.py验证TypeScript配套工件:
bash
uv run scripts/test_typescript_artifacts.pyRelated Skills
相关技能
- -- choose the connection path for the target system
motherduck-connect - -- inspect the target-side MotherDuck workspace
motherduck-explore - -- bulk movement and raw landing patterns
motherduck-load-data - -- shape the target analytical model
motherduck-model-data - -- port and validate critical SQL
motherduck-query - -- only when open-table-format requirements are explicit
motherduck-ducklake
- -- 为目标系统选择连接路径
motherduck-connect - -- 检查目标端MotherDuck工作区
motherduck-explore - -- 批量数据迁移和原始着陆模式
motherduck-load-data - -- 构建目标分析模型
motherduck-model-data - -- 迁移并验证关键SQL
motherduck-query - -- 仅在明确需要开放表格式时使用
motherduck-ducklake