def prepare_query(
self,
query_string: "capo_timestream_query.types.query_string.QueryString",
*,
config_overrides: Optional[TimestreamQueryClientConfig] = None,
validate_only: Optional[
"capo_timestream_query.types.nullable_boolean.NullableBoolean"
] = None,
) -> "capo_timestream_query.types.prepare_query_response.PrepareQueryResponse":
"""<p>A synchronous operation that allows you to submit a query with parameters to be stored by Timestream for later running. Timestream only supports using this operation with <code>ValidateOnly</code> set to <code>true</code>. </p>
Args:
query_string: <p>The Timestream query string that you want to use as a prepared statement. Parameter names can be specified in the query string <code>@</code> character followed by an identifier. </p>
validate_only: <p>By setting this value to <code>true</code>, Timestream will only validate that the query string is a valid Timestream query, and not store the prepared query for later use.</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.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.prepare_query_request.PrepareQueryRequest]",
) -> OperationResponse[
"capo_timestream_query.types.prepare_query_response.PrepareQueryResponse"
]:
import capo_timestream_query._operations.timestream_20181101.prepare_query
output, http_response = (
capo_timestream_query._operations.timestream_20181101.prepare_query.prepare_query(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_timestream_query.types.prepare_query_request.PrepareQueryRequest",
) -> dict[str, Any]:
import capo_timestream_query.types.prepare_query_request
return capo_timestream_query.types.prepare_query_request.redact_sensitive(
input_
)
def _redact_output(
output: "capo_timestream_query.types.prepare_query_response.PrepareQueryResponse",
) -> dict[str, Any]:
import capo_timestream_query.types.prepare_query_response
return capo_timestream_query.types.prepare_query_response.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging(
"PrepareQuery", redact_input=_redact_input, redact_output=_redact_output
),
)
input_: capo_timestream_query.types.prepare_query_request.PrepareQueryRequest = {
"query_string": query_string
}
if validate_only is not None:
input_["validate_only"] = validate_only
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output