executeScheduledQuery method

Future<void> executeScheduledQuery({
  1. required DateTime invocationTime,
  2. required String scheduledQueryArn,
  3. String? clientToken,
  4. ScheduledQueryInsights? queryInsights,
})

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.

May throw AccessDeniedException. May throw InternalServerException. May throw InvalidEndpointException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter invocationTime : The timestamp in UTC. Query will be run as if it was invoked at this timestamp.

Parameter scheduledQueryArn : ARN of the scheduled query.

Parameter clientToken : Not used.

Parameter queryInsights : Encapsulates settings for enabling QueryInsights.

Enabling QueryInsights returns insights and metrics as a part of the Amazon SNS notification for the query that you executed. You can use QueryInsights to tune your query performance and cost.

Implementation

Future<void> executeScheduledQuery({
  required DateTime invocationTime,
  required String scheduledQueryArn,
  String? clientToken,
  ScheduledQueryInsights? queryInsights,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'Timestream_20181101.ExecuteScheduledQuery'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'InvocationTime': unixTimestampToJson(invocationTime),
      'ScheduledQueryArn': scheduledQueryArn,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (queryInsights != null) 'QueryInsights': queryInsights,
    },
  );
}