SQL Translate
Developmentsql-translateSQL Translate is an Agent Skill for development published in the AltimateAI/altimate-code repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Translate SQL queries between database dialects (Snowflake, BigQuery, PostgreSQL, MySQL, etc.)
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/AltimateAI/altimate-code/blob/HEAD/.opencode/skills/sql-translate/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/sql-translate, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
SQL Translate
Requirements
Agent: builder or migrator (may write translated SQL to files) Tools used: sql_translate, read, write, altimate_core_validate
Translate SQL queries from one database dialect to another using sqlglot's transpilation engine.
Workflow
-
Determine source and target dialects — If the user did not specify both dialects, ask which source and target dialects to use. Common dialects:
snowflake,bigquery,postgres,mysql,tsql,hive,spark,databricks,redshift,duckdb. -
Get the SQL to translate — Either:
- Read from a file path provided by the user (use
read) - Accept inline SQL from the user's message
- Read from clipboard or stdin if mentioned
- Read from a file path provided by the user (use
-
Call
sql_translatewith:sql: The SQL query textsource_dialect: The source dialecttarget_dialect: The target dialect
-
Review the result:
- If
successis true, present the translated SQL - If there are
warnings, explain each one and what may need manual adjustment - If
successis false, explain the error and suggest fixes
- If
-
Format the output showing:
- Original SQL (labeled with source dialect)
- Translated SQL (labeled with target dialect)
- Any warnings about lossy translations or features that need manual review
-
Offer next steps if applicable:
- Suggest running
altimate_core_validateon the translated SQL to verify syntax - Offer to write the translated SQL to a file
- Offer to translate additional queries
- Suggest running
Usage
The user invokes this skill with optional dialect and SQL arguments:
/sql-translate— Interactive: ask for source dialect, target dialect, and SQL/sql-translate snowflake postgres— Translate from Snowflake to PostgreSQL (will ask for SQL)/sql-translate snowflake postgres SELECT DATEADD(day, 7, CURRENT_TIMESTAMP())— Full inline translation
Supported Dialects
| Dialect | Key |
|---|---|
| Snowflake | snowflake |
| BigQuery | bigquery |
| PostgreSQL | postgres |
| MySQL | mysql |
| SQL Server | tsql |
| Hive | hive |
| Spark SQL | spark |
| Databricks | databricks |
| Redshift | redshift |
| DuckDB | duckdb |
| SQLite | sqlite |
| Oracle | oracle |
| Trino/Presto | trino / presto |
Use the tools: sql_translate, read, write, altimate_core_validate.