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.
Parameters:
-
scheduled_query_arn
(AmazonResourceName)
–
ARN of the scheduled query.
-
invocation_time
(Time)
–
The timestamp in UTC. Query will be run as if it was invoked at this timestamp.
-
client_token
(Optional[ClientToken], default:
None
)
–
-
query_insights
(Optional[ScheduledQueryInsights], default:
None
)
–
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.
Raises:
Source code in docs_src/capo_timestream_query/_services/timestream_query.py
| def execute_scheduled_query(
self,
scheduled_query_arn: "capo_timestream_query.types.amazon_resource_name.AmazonResourceName",
invocation_time: "capo_timestream_query.types.time.Time",
*,
config_overrides: Optional[TimestreamQueryClientConfig] = None,
client_token: Optional[
"capo_timestream_query.types.client_token.ClientToken"
] = None,
query_insights: Optional[
"capo_timestream_query.types.scheduled_query_insights.ScheduledQueryInsights"
] = None,
) -> None:
"""<p> You can use this API to run a scheduled query manually. </p> <p>If you enabled <code>QueryInsights</code>, this API also returns insights and metrics related to the query that you executed as part of an Amazon SNS notification. <code>QueryInsights</code> helps with performance tuning of your query. For more information about <code>QueryInsights</code>, see <a href="https://docs.aws.amazon.com/timestream/latest/developerguide/using-query-insights.html">Using query insights to optimize queries in Amazon Timestream</a>.</p>
Args:
scheduled_query_arn: <p>ARN of the scheduled query.</p>
invocation_time: <p>The timestamp in UTC. Query will be run as if it was invoked at this timestamp. </p>
client_token: <p>Not used. </p>
query_insights: <p>Encapsulates settings for enabling <code>QueryInsights</code>.</p> <p>Enabling <code>QueryInsights</code> returns insights and metrics as a part of the Amazon SNS notification for the query that you executed. You can use <code>QueryInsights</code> to tune your query performance and cost.</p>
Raises:
capo_timestream_query.errors.access_denied_exception.AccessDeniedException: <p>You do not have the necessary permissions to access the account settings.</p>
capo_timestream_query.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred while processing the request.</p>
capo_timestream_query.errors.invalid_endpoint_exception.InvalidEndpointException: <p>The requested endpoint is invalid.</p>
capo_timestream_query.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found.</p>
capo_timestream_query.errors.throttling_exception.ThrottlingException: <p>The request was throttled due to excessive requests.</p>
capo_timestream_query.errors.validation_exception.ValidationException: <p> Invalid or malformed request. </p>
capo_timestream_query.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_timestream_query.types.execute_scheduled_query_request.ExecuteScheduledQueryRequest]",
) -> OperationResponse[None]:
import capo_timestream_query._operations.timestream_20181101.execute_scheduled_query
output, http_response = (
capo_timestream_query._operations.timestream_20181101.execute_scheduled_query.execute_scheduled_query(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_timestream_query.types.execute_scheduled_query_request.ExecuteScheduledQueryRequest",
) -> dict[str, Any]:
import capo_timestream_query.types.execute_scheduled_query_request
return capo_timestream_query.types.execute_scheduled_query_request.redact_sensitive(
input_
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("ExecuteScheduledQuery", redact_input=_redact_input),
)
input_: capo_timestream_query.types.execute_scheduled_query_request.ExecuteScheduledQueryRequest = {
"scheduled_query_arn": scheduled_query_arn,
"invocation_time": invocation_time,
}
if client_token is None:
client_token = str(uuid.uuid4())
input_["client_token"] = client_token
if query_insights is not None:
input_["query_insights"] = query_insights
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|