Skip to main content

scheduled_queries

Creates, updates, deletes, gets or lists a scheduled_queries resource.

Overview

Namescheduled_queries
TypeResource
Idaws.timestream_query.scheduled_queries

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
arnstringScheduled query ARN.
creation_timestring (date-time)Creation time of the scheduled query.
error_report_configurationobjectError-reporting configuration for the scheduled query.
kms_key_idstringA customer provided KMS key used to encrypt the scheduled query resource.
last_run_summaryobjectRuntime summary for the last scheduled query run.
namestringName of the scheduled query. (pattern: <code>[a-zA-Z0-9|!-*'()]([a-zA-Z0-9]|[!-*'()/.])+</code>)
next_invocation_timestring (date-time)The next time the scheduled query is scheduled to run.
notification_configurationobjectNotification configuration.
previous_invocation_timestring (date-time)Last time the query was run.
query_stringstringThe query to be run.
recently_failed_runsarrayRuntime summary for the last five failed scheduled query runs.
schedule_configurationobjectSchedule configuration.
scheduled_query_execution_role_arnstringIAM role that Timestream uses to run the schedule query.
statestringState of the scheduled query. (ENABLED, DISABLED)
target_configurationobjectScheduled query target store configuration.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_scheduled_queryselectregionProvides detailed information about a scheduled query.
list_scheduled_queriesselectregionGets a list of all scheduled queries in the caller's Amazon account and Region. ListScheduledQueries is eventually consistent.
create_scheduled_queryinsertregion, QueryString, ScheduleConfiguration, NotificationConfiguration, ScheduledQueryExecutionRoleArn, ErrorReportConfigurationCreate a scheduled query that will be run on your behalf at the configured schedule. Timestream assumes the execution role provided as part of the ScheduledQueryExecutionRoleArn parameter to run the query. You can use the NotificationConfiguration parameter to configure notification for your scheduled query operations.
update_scheduled_queryupdateregion, ScheduledQueryArnUpdate a scheduled query.
delete_scheduled_querydeleteregionDeletes a given scheduled query. This is an irreversible operation.
execute_scheduled_queryexecregion, ScheduledQueryArn, InvocationTimeYou can use this API to run a scheduled query manually. If you enabled QueryInsights, this API also returns insights and metrics related to the query that you executed as part of an Amazon SNS notification. QueryInsights helps with performance tuning of your query. For more information about QueryInsights, see Using query insights to optimize queries in Amazon Timestream.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Provides detailed information about a scheduled query.

SELECT
arn,
creation_time,
error_report_configuration,
kms_key_id,
last_run_summary,
name,
next_invocation_time,
notification_configuration,
previous_invocation_time,
query_string,
recently_failed_runs,
schedule_configuration,
scheduled_query_execution_role_arn,
state,
target_configuration
FROM aws.timestream_query.scheduled_queries
WHERE region = '{{ region }}' -- required
;

INSERT examples

Create a scheduled query that will be run on your behalf at the configured schedule. Timestream assumes the execution role provided as part of the ScheduledQueryExecutionRoleArn parameter to run the query. You can use the NotificationConfiguration parameter to configure notification for your scheduled query operations.

INSERT INTO aws.timestream_query.scheduled_queries (
Name,
QueryString,
ScheduleConfiguration,
NotificationConfiguration,
TargetConfiguration,
ClientToken,
ScheduledQueryExecutionRoleArn,
Tags,
KmsKeyId,
ErrorReportConfiguration,
region
)
SELECT
'{{ Name }}',
'{{ QueryString }}' /* required */,
'{{ ScheduleConfiguration }}' /* required */,
'{{ NotificationConfiguration }}' /* required */,
'{{ TargetConfiguration }}',
'{{ ClientToken }}',
'{{ ScheduledQueryExecutionRoleArn }}' /* required */,
'{{ Tags }}',
'{{ KmsKeyId }}',
'{{ ErrorReportConfiguration }}' /* required */,
'{{ region }}'
RETURNING
arn
;

UPDATE examples

Update a scheduled query.

UPDATE aws.timestream_query.scheduled_queries
SET
ScheduledQueryArn = '{{ ScheduledQueryArn }}',
State = '{{ State }}'
WHERE
region = '{{ region }}' --required
AND ScheduledQueryArn = '{{ ScheduledQueryArn }}' --required;

DELETE examples

Deletes a given scheduled query. This is an irreversible operation.

DELETE FROM aws.timestream_query.scheduled_queries
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

You can use this API to run a scheduled query manually. If you enabled QueryInsights, this API also returns insights and metrics related to the query that you executed as part of an Amazon SNS notification. QueryInsights helps with performance tuning of your query. For more information about QueryInsights, see Using query insights to optimize queries in Amazon Timestream.

EXEC aws.timestream_query.scheduled_queries.execute_scheduled_query
@region='{{ region }}' --required
@@json=
'{
"ScheduledQueryArn": "{{ ScheduledQueryArn }}",
"InvocationTime": "{{ InvocationTime }}",
"ClientToken": "{{ ClientToken }}",
"QueryInsights": "{{ QueryInsights }}"
}'
;