ExecuteScheduledQuery - Amazon Timestream
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

ExecuteScheduledQuery

您可以使用此 API 手动运行计划查询。

如果您启用QueryInsights,此 API 还会返回与您在 Amazon SNS 通知中执行的查询相关的见解和指标。 QueryInsights有助于调整查询的性能。有关更多信息QueryInsights,请参阅在 Amazon Timestream 中使用查询见解来优化 Amazon Timestream 中的查询

请求语法

{ "ClientToken": "string", "InvocationTime": number, "QueryInsights": { "Mode": "string" }, "ScheduledQueryArn": "string" }

请求参数

有关所有操作的通用参数的信息,请参阅常用参数

请求接受采用 JSON 格式的以下数据。

ClientToken

未使用。

类型:字符串

长度限制:最小长度为 32。最大长度为 128。

必需:否

InvocationTime

时间戳(以 UTC 为单位)。查询将像在此时间戳被调用一样运行。

类型:时间戳

必需:是

QueryInsights

封装用于启用的设置。QueryInsights

在您执行的查询的 Amazon SNS 通知中启用QueryInsights退货见解和指标。您可以使用QueryInsights来调整查询性能和成本。

类型:ScheduledQueryInsights 对象

必需:否

ScheduledQueryArn

计划查询的 ARN。

类型:字符串

长度限制:最小长度为 0。最大长度为 2048。

必需:是

响应元素

如果此操作成功,则该服务会发送回带有空 HTTP 正文的 HTTP 200 响应。

错误

有关所有操作的常见错误的信息,请参阅常见错误

AccessDeniedException

您没有访问账户设置所需的权限。

HTTP 状态代码:400

InternalServerException

处理请求时出现内部服务器错误。

HTTP 状态代码:400

InvalidEndpointException

请求的端点无效。

HTTP 状态代码:400

ResourceNotFoundException

找不到请求的资源。

HTTP 状态代码:400

ThrottlingException

由于请求过多,请求受到限制。

HTTP 状态代码:400

ValidationException

请求无效或格式不正确。

HTTP 状态代码:400

示例

ENABLED_WITH_RATE_CONTROL 模式的预设查询通知消息

以下示例显示了QueryInsights参数ENABLED_WITH_RATE_CONTROL模式的成功计划查询通知消息。

"SuccessNotificationMessage": { "type": "MANUAL_TRIGGER_SUCCESS", "arn": "arn:aws:timestream:<Region>:<Account>:scheduled-query/sq-test-49c6ed55-c2e7-4cc2-9956-4a0ecea13420-80e05b035236a4c3", "scheduledQueryRunSummary": { "invocationEpochSecond": 1723710546, "triggerTimeMillis": 1723710547490, "runStatus": "MANUAL_TRIGGER_SUCCESS", "executionStats": { "executionTimeInMillis": 17343, "dataWrites": 1024, "bytesMetered": 0, "cumulativeBytesScanned": 600, "recordsIngested": 1, "queryResultRows": 1 }, "queryInsightsResponse": { "querySpatialCoverage": { "max": { "value": 1.0, "tableArn": "arn:aws:timestream:<Region>:<Account>:database/BaseDb/table/BaseTable", "partitionKey": [ "measure_name" ] } }, "queryTemporalRange": { "max": { "value": 2399999999999, "tableArn": "arn:aws:timestream:<Region>:<Account>:database/BaseDb/table/BaseTable" } }, "queryTableCount": 1, "outputRows": 1, "outputBytes": 59 } } }

禁用模式的预设查询通知消息

以下示例显示了QueryInsights参数DISABLED模式的成功计划查询通知消息。

"SuccessNotificationMessage": { "type": "MANUAL_TRIGGER_SUCCESS", "arn": "arn:aws:timestream:<Region>:<Account>:scheduled-query/sq-test-fa109d9e-6528-4a0d-ac40-482fa05e657f-140faaeecdc5b2a7", "scheduledQueryRunSummary": { "invocationEpochSecond": 1723711401, "triggerTimeMillis": 1723711402144, "runStatus": "MANUAL_TRIGGER_SUCCESS", "executionStats": { "executionTimeInMillis": 17992, "dataWrites": 1024, "bytesMetered": 0, "cumulativeBytesScanned": 600, "recordsIngested": 1, "queryResultRows": 1 } } }

ENABLED_WITH_RATE_CONTROL 模式的失败通知消息

以下示例显示了QueryInsights参数ENABLED_WITH_RATE_CONTROL模式的计划查询失败通知消息。

"FailureNotificationMessage": { "type": "MANUAL_TRIGGER_FAILURE", "arn": "arn:aws:timestream:<Region>:<Account>:scheduled-query/sq-test-b261670d-790c-4116-9db5-0798071b18b1-b7e27a1d79be226d", "scheduledQueryRunSummary": { "invocationEpochSecond": 1727915513, "triggerTimeMillis": 1727915513894, "runStatus": "MANUAL_TRIGGER_FAILURE", "executionStats": { "executionTimeInMillis": 10777, "dataWrites": 0, "bytesMetered": 0, "cumulativeBytesScanned": 0, "recordsIngested": 0, "queryResultRows": 4 }, "errorReportLocation": { "s3ReportLocation": { "bucketName": "amzn-s3-demo-bucket", "objectKey": "4my-organization-f7a3c5d065a1a95e/1727915513/MANUAL/1727915513894/5e14b3df-b147-49f4-9331-784f749b68ae" } }, "failureReason": "Schedule encountered some errors and is incomplete. Please take a look at error report for further details" } }

禁用模式的失败通知消息

以下示例显示了QueryInsights参数DISABLED模式的计划查询失败通知消息。

"FailureNotificationMessage": { "type": "MANUAL_TRIGGER_FAILURE", "arn": "arn:aws:timestream:<Region>:<Account>:scheduled-query/sq-test-b261670d-790c-4116-9db5-0798071b18b1-b7e27a1d79be226d", "scheduledQueryRunSummary": { "invocationEpochSecond": 1727915194, "triggerTimeMillis": 1727915195119, "runStatus": "MANUAL_TRIGGER_FAILURE", "executionStats": { "executionTimeInMillis": 10777, "dataWrites": 0, "bytesMetered": 0, "cumulativeBytesScanned": 0, "recordsIngested": 0, "queryResultRows": 4 }, "errorReportLocation": { "s3ReportLocation": { "bucketName": "amzn-s3-demo-bucket", "objectKey": "4my-organization-b7e27a1d79be226d/1727915194/MANUAL/1727915195119/08dea9f5-9a0a-4e63-a5f7-ded23247bb98" } }, "failureReason": "Schedule encountered some errors and is incomplete. Please take a look at error report for further details" } }

另请参阅

有关以特定语言之一使用此 API 的更多信息 Amazon SDKs,请参阅以下内容: