bigquery-migration-sql-translator
它能做什么
这个技能帮你把数据库从旧系统迁移到 BigQuery。它适用于需要把查询、表定义和脚本迁移到 Google Cloud 的团队。
适用场景
- ✓当你要把 SQL 查询从 Teradata、Oracle、Redshift、Snowflake 或 Hive 迁移到 BigQuery 的时候。
- ✓当你需要把数据库结构或元数据存档迁移到 BigQuery 的时候。
- ✓当你需要为 BigQuery 迁移设置批量转换配置的时候。
技能链接
https://github.com/google/skills/blob/main/skills/cloud/bigquery-migration-sql-translator/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把我的 Oracle 存储过程和查询转换为 BigQuery SQL,并告诉我哪些没有被干净地转换。”
每周 5 个新技能,1 分钟读完。
工作原理
它使用 BigQuery Migration Service 转换脚本和结构。它会把文件暂存到 Cloud Storage,并帮你修复它报告的任何编译错误。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
BigQuery Migration Service (BQMS) SQL Translator
The BigQuery Migration Service (BQMS) translates legacy database SQL scripts, queries, and schemas into GoogleSQL. This skill coordinates translation workflows, Cloud Storage staging, compiler error triage, and YAML configuration.
Usage Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read and follow the instructions in
Usage Attribution.
Before you begin
Before translating queries or schemas, verify the following prerequisites:
Google Cloud SDK & Project Setup: Ensure the Google Cloud SDK is installed, verify that your Google Cloud project has an active Cloud Billing account attached, and select the target project:
gcloud config set project {project_id}Enable the API: Enable the BigQuery Migration API (
bigquerymigration.googleapis.com) in your Google Cloud project:gcloud services enable bigquerymigration.googleapis.comRequired IAM Roles: Verify that your identity or service account has:
roles/mcp.toolUser(MCP Tool User)roles/bigquerymigration.editor(Migration Workflow Editor)- For batch translation,
roles/storage.objectViewerandroles/storage.objectCreator(orroles/storage.objectAdmin) on the Cloud Storage buckets that hold the input and output files.
MCP Server Connection: If BigQuery Migration Service (BQMS) tools (e.g.
translate_query,translate_batch_queries) are not present in your active tool list, configure the remote BigQuery Migration Service (BQMS) MCP server. For setup instructions across clients (Claude, Cursor, Gemini CLI, VS Code), see mcp_config.md.Cost & Cloud Storage Cleanup: Review Google Cloud Pricing for Cloud Storage and BigQuery usage details. After completing a batch migration, clean up temporary staged input and output folders in Cloud Storage:
gcloud storage rm -r gs://{bucket}/{folder}Translation Tracking: For batch translations, and for queries that need more than one translation iteration, keep a translation tracker (e.g.
translation_tracker.md) to document goals, planned steps, and progress. After each translation, record one row with this template:Iteration Status Total Errors Correctness Errors Completeness Errors Compatibility Errors Key Actions / Transformations A single query that translates cleanly on the first attempt needs no tracker: report its translation ID and logs in your response.
Workflow Selection
Choose the workflow based on your migration scope:
- Interactive Translation (Single Query): Best for ad-hoc queries, exploratory testing, dialect syntax comparison, or quick error debugging.
- Batch Translation (Multiple Files & Cloud Storage): Use for more than
one file or a directory, including SQL embedded in application code (extract
it into
.sqlfiles first). For multi-file Python codebases containing embedded SQL, use python_embedded_sql_migrator_template.py to extract queries into staged files and re-inject translated SQL. Batch translation is faster and cheaper than translating files one by one, and it resolves cross-file dependencies, so it usually gives better results. Runtranslate_batch_querieson the staged files first; usetranslate_queryonly afterwards if needed to debug a specific statement fromtranslation_report.csv.
1. Interactive Translation Workflow
Use the interactive workflow to translate a single query string, inspect compiler logs, and iteratively resolve issues.
Steps
Submit Query (
translate_query): Calltranslate_querywithprojectNumber,location,inputQuery,sourceDialect, andtargetDialect(BigQuery). Include optional parameters:metadataFilePath: Cloud Storage URI to a metadata zip file (gs://.../metadata.zip) for schema resolution.translationConfigs: Inline YAML configurations (e.g. object renaming, s
常见问题
我需要开启 API 吗?
需要。转换之前,必须在你的项目中启用 BigQuery Migration API。
它支持哪些旧系统?
列出的有 Teradata、Oracle、Redshift、Snowflake、SparkSQL 和 HiveQL。
它需要额外权限吗?
需要。它需要 MCP tool user 和 migration editor 角色,以及批处理作业所需的存储角色。
详情
作者的原始描述
Translates SQL queries, DDL schemas, and stored procedures from legacy database dialects (Teradata, Oracle, Redshift, Snowflake, SparkSQL, HiveQL) to BigQuery GoogleSQL using the BigQuery Migration Service (BQMS) MCP server. Use when translating legacy SQL queries, migrating schemas or metadata zip archives, or configuring BigQuery Migration Service (BQMS) YAML translation settings. Don't use for executing BigQuery queries or managing datasets and tables (use bigquery-basics), diagnosing runtime job errors (use bigquery-troubleshooting), or tuning slot reservations (use bigquery-optimization).
repo: google/skills
热度
- GitHub 星标
- 22k
- 排名
- #10227
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
finding-google-skills
22k帮你的智能体为某项设置任务找到合适的 Google 指南,例如托管、数据库、存储、登录或 AI 模型服务。
gcloud
22k帮你的智能体编写并检查 Google Cloud gcloud 命令,在运行任何内容之前查阅准确的语法,避免猜测参数。
google-cloud-recipe-auth
22k引导你的智能体了解 Google Cloud 的身份与访问管理,包括人员和服务如何登录,以及它们各自获得哪些权限。
google-cloud-recipe-onboarding
22k带领新开发者完成在 Google Cloud 上的第一步,包括选择项目、关联计费,以及部署第一个资源。