本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
查詢 SDK 用戶端
您可以使用下列程式碼片段來建立查詢SDK的 Timestream 用戶端。Query SDK 用於查詢儲存在 Timestream 中的現有時間序列資料。
- Java
-
private static AmazonTimestreamQuery buildQueryClient() { AmazonTimestreamQuery client = AmazonTimestreamQueryClient.builder().withRegion("us-east-1").build(); return client; }
- Java v2
-
private static TimestreamQueryClient buildQueryClient() { return TimestreamQueryClient.builder() .region(Region.US_EAST_1) .build(); }
- Go
-
sess, err := session.NewSession(&aws.Config{Region: aws.String("us-east-1")})
- Python
-
query_client = session.client('timestream-query')
- Node.js
-
下列程式碼片段使用 AWS SDK for JavaScript v3。如需如何安裝用戶端和用量的詳細資訊,請參閱 Timestream Query Client - ,AWS SDK for JavaScript v3。
此處顯示額外的命令匯入。建立用戶端不需要
QueryCommand
匯入。import { TimestreamQueryClient, QueryCommand } from "@aws-sdk/client-timestream-query"; const queryClient = new TimestreamQueryClient({ region: "us-east-1" });
下列程式碼片段使用 AWS SDK for JavaScript V2 樣式。它以 Node.js 範例 Amazon Timestream for LiveAnalytics 應用程式 on GitHub 的範例應用程式為基礎。
queryClient = new AWS.TimestreamQuery();
- .NET
-
var queryClientConfig = new AmazonTimestreamQueryConfig { RegionEndpoint = RegionEndpoint.USEast1 }; var queryClient = new AmazonTimestreamQueryClient(queryClientConfig);
寫入 SDK 用戶端
建立資料庫