Automating AMC workflows: saved queries, parameters and schedules
In short: An AMC workflow is a saved SQL query with a unique `workflowId`. You run it on demand or create a schedule that starts it daily or weekly and puts the result in the instance's S3 bucket. Parameters let you set values only at execution.
Creating a workflow
- A workflow is a SQL query with a
workflowIdthat may contain only letters, digits, periods, dashes and underscores, for exampleStreaming_T.V_Performance-Report2023. sqlQuerymust be a single-line query without tabs and line breaks; a trailing semicolon is not required.- When defining it the aggregation requirements apply so that the privacy of customers is preserved. A saved workflow produces results only once you execute or schedule it.
Parameters instead of hard-coded values
In the workflow you define custom parameters, optionally with defaultValue, and set the values at execution. The simple types BINARY, BOOLEAN, BYTE, DATE, DOUBLE, FLOAT, INTEGER, LONG, SHORT, STRING, TIMESTAMP and ARRAY of these types are supported. Never add information about an individual, such as an email or phone number, to the description or a parameter value.
Executing: time window and data freshness
| `timeWindowType` | Time window |
|---|---|
EXPLICIT | Start and end are given explicitly in the request. |
MOST_RECENT_DAY | Default: the most recent day for which the instance is likely to have data. |
MOST_RECENT_WEEK | The most recent week likely to have data, aligned to day boundaries. |
CURRENT_MONTH | From the start of the month up to the latest time with data. |
PREVIOUS_MONTH | The entire previous month. |
AMC does not ingest data in real time. Amazon recommends a date range ending 48 hours before the current date, because the data can take up to 48 hours to be available. For the limits on parallel executions see the error page on the limit.
Schedules and results
- A schedule sets cadence, day of week and time of day. The parameter
aggregationHourUtcis the offset in hours from midnight UTC: 10 a.m. MST is 4 p.m. UTC, so 16. ScheduleEnabled=trueenables the schedule; withfalsethe workflow is not queued.- Without a value,
aggregationStartDaydefaults to the creation day for weekly aggregation; for daily it is not used. - The result lands in the instance's S3 bucket, about 6 to 7 hours after the scheduled time according to Amazon; the file carries the suffix
-ver1.csvand omits invalid traffic.
Frequently asked questions
Does a saved workflow produce results on its own?
No. Only an execution or a schedule produces output data.