Tool: generate_ddl_suggestion
Suggests Data Definition Language (DDL) statements for an input query. For example, CREATE TABLE or CREATE VIEW. The generated DDL provides schema definitions for tables and views that are used in the query. To get DDL suggestions, call this tool, and then use the fetch_ddl_suggestion tool with the returned suggestion ID to retrieve the DDL. You can then prepend the retrieved DDL to the original input query and translate it again to improve translation quality.
The following sample demonstrate how to use curl to invoke the generate_ddl_suggestion MCP tool.
| Curl Request |
|---|
curl --location 'https://bigquerymigration.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "generate_ddl_suggestion", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request message for GenerateDdlSuggestion.
GenerateDdlSuggestionRequest
| JSON representation |
|---|
{ "projectNumber": string, "location": string, "inputQuery": string, "sourceDialect": string, "targetDialect": string } |
| Fields | |
|---|---|
projectNumber |
Required. The Google Cloud project number. |
location |
Required. The location. |
inputQuery |
Required. The query string for which the DDL suggestion is generated. |
sourceDialect |
Required. The dialect of the source query. The following source to target dialect pairs are supported: source: Teradata, Bteq, Redshift, Oracle, HiveQL, Impala, SparkSQL, Snowflake, Netezza, AzureSynapse, Vertica, SQLServer, Presto, MySQL, Postgresql, Db2, SQLite, Greenplum, BigQuery; target: BigQuery. |
targetDialect |
Required. The dialect of the target query. See list of supported pairs in source_dialect. |
Output Schema
Response message for GenerateDdlSuggestion.
GenerateDdlSuggestionResponse
| JSON representation |
|---|
{ "suggestion": string, "suggestionState": string, "logs": [ { object ( |
| Fields | |
|---|---|
suggestion |
The ID of the DDL suggestion. Use this ID for the |
suggestionState |
The current state of the DDL suggestion, for example, |
logs[] |
A list of logs generated during the DDL suggestion process. |
errorInfo |
The error information. |
Log
| JSON representation |
|---|
{ "severity": string, "category": string, "message": string, "action": string, "effect": string, "impactedObject": string } |
| Fields | |
|---|---|
severity |
Severity of the translation record, for example, |
category |
Category of the error or warning, for example, |
message |
Detailed message of the record. |
action |
Recommended action to address the log. |
effect |
The effect or impact of the issue noted in the log. Effect can be one of the following values: |
impactedObject |
Name of the object that is impacted by the log message. |
ErrorInfo
| JSON representation |
|---|
{ "reason": string, "domain": string, "metadata": { string: string, ... } } |
| Fields | |
|---|---|
reason |
The reason of the error. This is a constant value that identifies the proximate cause of the error. Error reasons are unique within a particular domain of errors. This should be at most 63 characters and match a regular expression of |
domain |
The logical grouping to which the "reason" belongs. The error domain is typically the registered service name of the tool or product that generates the error. Example: "pubsub.googleapis.com". If the error is generated by some common infrastructure, the error domain must be a globally unique value that identifies the infrastructure. For Google API infrastructure, the error domain is "googleapis.com". |
metadata |
Additional structured details about this error. Keys must match a regular expression of An object containing a list of |
MetadataEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ❌ | Read Only Hint: ❌ | Open World Hint: ❌