Writing AMC SQL with AI: provide the schema and check the result
In short: AI models write usable AMC SQL if you give them the schema of the tables, and otherwise invent fields and functions. Check every result: field names against the schema reference, functions against Amazon's list, `user_id` never in the final SELECT. Test in the sandbox first, then in the instance.
The workflow
- Provide the schema: copy the field list of the tables involved from the schema reference into the prompt, including thresholds. Without a schema the model guesses field names.
- Provide the rules: final SELECT without VERY_HIGH fields such as
user_id(only in CTEs or insideCOUNT(DISTINCT …)), no literal filters on fields with a high threshold. - Check the result (see below), run it in the sandbox, then in the instance.
Typical missteps and how to spot them
| Misstep | How to check |
|---|---|
Invented function (for example SIMILARITY or ARRAY_JOIN) | Check against Amazon's function list; it has ARRAY_TO_STRING, for example |
| Invented or misspelled field | Look up each name in the schema reference of the table |
user_id in the final SELECT | AMC rejects it; user_id only in a CTE or in COUNT(DISTINCT user_id) |
| Multi-line SQL in an API request | Make sqlQuery single-line, without tabs and line breaks |
| Too many similar variants in a row | Combine queries; AMC rejects executions on overlapping data sources |
Amazon's own tools for AMC SQL
Besides your own model with the schema, Amazon itself offers two routes since 2026. Status as of 2026-11-18 according to Amazon's announcements:
| Route | Status | Region | Prerequisite | Cost |
|---|---|---|---|---|
| Amazon Ads Agent (conversation directly in AMC) | available according to Amazon for advertisers working directly in AMC | not stated | AMC instance | not stated |
| AMC SQL Generator (expert tool on the Amazon Ads MCP Server) | Closed beta since 2026-09-30, application required; general availability announced for early 2027 | US only during the beta | active AMC instance, developer account, Amazon Ads API access | covered by Amazon during the beta; from 2027 pay per token via AWS Marketplace |
| Your own model (ChatGPT, Claude) with the schema | right away | no restriction by Amazon | schema and rules in the prompt | your model contract |
Check SQL generated by Amazon the same way as above against schema and thresholds, and test it in the sandbox. The Amazon Ads MCP Server itself has been in an open beta since 2026-02-02 for partners with active API credentials.
Privacy when prompting
Give the model the schema and synthetic or sandbox examples, not result rows with real campaign or customer data. In the workflow documentation Amazon explicitly points out never to put information about individuals into descriptions or parameter values. Which data an external provider may see is for your data protection office to decide.