

如需與 Amazon Timestream for LiveAnalytics 類似的功能，請考慮使用 Amazon Timestream for InfluxDB。它提供簡化的資料擷取和單一位數毫秒查詢回應時間，以進行即時分析。[在這裡](https://docs.aws.amazon.com//timestream/latest/developerguide/timestream-for-influxdb.html)進一步了解。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# PrepareQuery
<a name="API_query_PrepareQuery"></a>

同步操作，可讓您提交查詢，其中包含由 Timestream 存放以供稍後執行的參數。Timestream 僅支援將 `ValidateOnly` 設定為 的此操作`true`。

## 請求語法
<a name="API_query_PrepareQuery_RequestSyntax"></a>

```
{
   "QueryString": "string",
   "ValidateOnly": boolean
}
```

## 請求參數
<a name="API_query_PrepareQuery_RequestParameters"></a>

如需所有動作的一般參數資訊，請參閱《[Common Parameters](CommonParameters.md)》。

請求接受採用 JSON 格式的下列資料。

 ** [QueryString](#API_query_PrepareQuery_RequestSyntax) **   <a name="timestream-query_PrepareQuery-request-QueryString"></a>
您想要用作預備陳述式的 Timestream 查詢字串。參數名稱可以在後跟一個識別碼的查詢字串 `@` 字元中指定。  
類型：字串  
長度限制：長度下限為 1。長度上限為 262144。  
必要：是

 ** [ValidateOnly](#API_query_PrepareQuery_RequestSyntax) **   <a name="timestream-query_PrepareQuery-request-ValidateOnly"></a>
透過將此值設定為 `true`，Timestream 只會驗證查詢字串是否為有效的 Timestream 查詢，而不會存放準備好的查詢以供日後使用。  
類型：布林值  
必要：否

## 回應語法
<a name="API_query_PrepareQuery_ResponseSyntax"></a>

```
{
   "Columns": [ 
      { 
         "Aliased": boolean,
         "DatabaseName": "string",
         "Name": "string",
         "TableName": "string",
         "Type": { 
            "ArrayColumnInfo": { 
               "Name": "string",
               "Type": "Type"
            },
            "RowColumnInfo": [ 
               { 
                  "Name": "string",
                  "Type": "Type"
               }
            ],
            "ScalarType": "string",
            "TimeSeriesMeasureValueColumnInfo": { 
               "Name": "string",
               "Type": "Type"
            }
         }
      }
   ],
   "Parameters": [ 
      { 
         "Name": "string",
         "Type": { 
            "ArrayColumnInfo": { 
               "Name": "string",
               "Type": "Type"
            },
            "RowColumnInfo": [ 
               { 
                  "Name": "string",
                  "Type": "Type"
               }
            ],
            "ScalarType": "string",
            "TimeSeriesMeasureValueColumnInfo": { 
               "Name": "string",
               "Type": "Type"
            }
         }
      }
   ],
   "QueryString": "string"
}
```

## 回應元素
<a name="API_query_PrepareQuery_ResponseElements"></a>

如果動作成功，則服務傳回 HTTP 200 回應。

服務會傳回下列 JSON 格式的資料。

 ** [Columns](#API_query_PrepareQuery_ResponseSyntax) **   <a name="timestream-query_PrepareQuery-response-Columns"></a>
所提交查詢字串的 SELECT 子句資料欄清單。  
類型：[SelectColumn](API_query_SelectColumn.md) 物件陣列

 ** [Parameters](#API_query_PrepareQuery_ResponseSyntax) **   <a name="timestream-query_PrepareQuery-response-Parameters"></a>
已提交查詢字串中使用的參數清單。  
類型：[ParameterMapping](API_query_ParameterMapping.md) 物件陣列

 ** [QueryString](#API_query_PrepareQuery_ResponseSyntax) **   <a name="timestream-query_PrepareQuery-response-QueryString"></a>
您要準備的查詢字串。  
類型：字串  
長度限制：長度下限為 1。長度上限為 262144。

## 錯誤
<a name="API_query_PrepareQuery_Errors"></a>

如需所有動作常見錯誤的資訊，請參閱[常見錯誤](CommonErrors.md)。

 ** AccessDeniedException **   
您沒有存取帳戶設定的必要許可。  
HTTP 狀態碼：400

 ** InternalServerException **   
處理請求時發生內部伺服器錯誤。  
HTTP 狀態碼：400

 ** InvalidEndpointException **   
請求的端點無效。  
HTTP 狀態碼：400

 ** ThrottlingException **   
請求因請求過多而受到限流。  
HTTP 狀態碼：400

 ** ValidationException **   
 無效或格式不正確的請求。  
HTTP 狀態碼：400

## 另請參閱
<a name="API_query_PrepareQuery_SeeAlso"></a>

如需在其中一種語言特定 AWS SDKs中使用此 API 的詳細資訊，請參閱下列內容：
+  [AWS 命令列界面 V2](https://docs.aws.amazon.com/goto/cli2/timestream-query-2018-11-01/PrepareQuery) 
+  [AWS 適用於 .NET V4 的 SDK](https://docs.aws.amazon.com/goto/DotNetSDKV4/timestream-query-2018-11-01/PrepareQuery) 
+  [AWS 適用於 C\$1\$1 的 SDK](https://docs.aws.amazon.com/goto/SdkForCpp/timestream-query-2018-11-01/PrepareQuery) 
+  [AWS 適用於 Go 的 SDK v2](https://docs.aws.amazon.com/goto/SdkForGoV2/timestream-query-2018-11-01/PrepareQuery) 
+  [AWS 適用於 Java V2 的 SDK](https://docs.aws.amazon.com/goto/SdkForJavaV2/timestream-query-2018-11-01/PrepareQuery) 
+  [AWS 適用於 JavaScript V3 的 SDK](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/timestream-query-2018-11-01/PrepareQuery) 
+  [AWS 適用於 Kotlin 的 SDK](https://docs.aws.amazon.com/goto/SdkForKotlin/timestream-query-2018-11-01/PrepareQuery) 
+  [AWS 適用於 PHP V3 的 SDK](https://docs.aws.amazon.com/goto/SdkForPHPV3/timestream-query-2018-11-01/PrepareQuery) 
+  [AWS 適用於 Python 的 SDK](https://docs.aws.amazon.com/goto/boto3/timestream-query-2018-11-01/PrepareQuery) 
+  [AWS 適用於 Ruby V3 的 SDK](https://docs.aws.amazon.com/goto/SdkForRubyV3/timestream-query-2018-11-01/PrepareQuery) 