本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
ExecuteScheduledQuery
您可以使用它手動API執行排程查詢。
如果您啟用 QueryInsights
,這API也會傳回與您在 Amazon SNS通知中執行之查詢相關的洞見和指標。 QueryInsights
可協助您調校查詢的效能。如需 的詳細資訊QueryInsights
,請參閱使用查詢洞見來最佳化 Amazon Timestream 中的查詢。
請求語法
{
"ClientToken": "string
",
"InvocationTime": number
,
"QueryInsights": {
"Mode": "string
"
},
"ScheduledQueryArn": "string
"
}
請求參數
如需所有動作的一般參數資訊,請參閱《Common Parameters》。
請求接受以下JSON格式的資料。
- ClientToken
-
未使用。
類型:字串
長度限制:長度下限為 32。長度上限為 128。
必要:否
- InvocationTime
-
中的時間戳記UTC。查詢將如同在此時間戳記叫用一樣執行。
類型:Timestamp
必要:是
- QueryInsights
-
封裝啟用 的設定
QueryInsights
。啟用 會
QueryInsights
傳回洞見和指標,做為您所執行查詢的 Amazon SNS通知的一部分。您可以使用QueryInsights
來調整查詢效能和成本。類型:ScheduledQueryInsights 物件
必要:否
- ScheduledQueryArn
-
ARN 排程查詢的 。
類型:字串
長度限制:長度下限為 1。長度上限為 2048。
必要:是
回應元素
如果動作成功,服務會傳回 200 HTTP 回應並顯示空白HTTP內文。
錯誤
如需所有動作常見錯誤的資訊,請參閱常見錯誤。
- 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 } } }
DISABLED 模式的排程查詢通知訊息
下列範例顯示 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" } }
DISABLED 模式的失敗通知訊息
下列範例顯示 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中使用此功能的詳細資訊 AWS SDKs,請參閱以下內容: