DescribeTimeseriesTable 操作を呼び出して、生存時間(TTL)構成など、時系列テーブルの情報をクエリできます。
前提条件
時系列テーブルが作成されていること。詳細については、「時系列テーブルの作成」をご参照ください。
TimeseriesClient インスタンスが初期化されていること。詳細については、「OTSClient インスタンスの初期化」をご参照ください。
パラメータ
パラメータ | 説明 |
timeseriesTableName | 時系列テーブルの名前。 |
例
次のサンプルコードは、時系列テーブルの情報をクエリする方法の例を示しています。
func DescribeTimeseriesTableSample(client *tablestore.TimeseriesClient, timeseriesTableName string) {
fmt.Println("[Info]: Begin to require timeseries table description!") // [情報]: 時系列テーブルの説明の要求を開始します!
describeTimeseriesTableRequest := tablestore.NewDescribeTimeseriesTableRequset(timeseriesTableName) // リクエストを構築し、時系列テーブルの名前を指定します。
describeTimeseriesTableResponse, err := client.DescribeTimeseriesTable(describeTimeseriesTableRequest)
if err != nil {
fmt.Println("[Error]: Failed to require timeseries table description!") // [エラー]: 時系列テーブルの説明の要求に失敗しました!
return
}
fmt.Println("[Info]: DescribeTimeseriesTableSample finished. Timeseries table meta: ") // [情報]: DescribeTimeseriesTableSample が完了しました。時系列テーブルのメタデータ:
fmt.Println("[Info]: TimeseriesTableName: ", describeTimeseriesTableResponse.GetTimeseriesTableMeta().GetTimeseriesTableName()) // [情報]: 時系列テーブル名:
fmt.Println("[Info]: TimeseriesTable TTL: ", describeTimeseriesTableResponse.GetTimeseriesTableMeta().GetTimeseriesTableOPtions().GetTimeToLive()) // [情報]: 時系列テーブルの TTL:
//If you have created an analytical store for the time series table, you can use the following code to obtain the analytical store information. // 時系列テーブルの分析ストアを作成した場合は、次のコードを使用して分析ストア情報を取得できます。
analyticalStores := describeTimeseriesTableResponse.GetAnalyticalStores()
for _, analyticalStore := range analyticalStores {
fmt.Println("[Info]: AnalyticalStoreName: ", analyticalStore.StoreName) // [情報]: 分析ストア名:
if analyticalStore.TimeToLive != nil {
fmt.Println("[Info]: TimeToLive: ", *analyticalStore.TimeToLive) // [情報]: TimeToLive:
}
if analyticalStore.SyncOption != nil {
fmt.Println("[Info]: SyncOption: ", *analyticalStore.SyncOption) // [情報]: SyncOption:
}
}
}参照
詳細については、「DescribeTimeseriesTable」をご参照ください。
時系列テーブルからデータを読み取るか、時系列テーブルにデータを書き込む場合は、特定の API 操作を呼び出すことができます。詳細については、「時系列データの書き込み」および「時系列データのクエリ」をご参照ください。
生存時間(TTL)など、時系列テーブルに関する情報を変更する場合は、時系列テーブルを更新できます。詳細については、「時系列テーブルの更新」をご参照ください。
不要になった時系列テーブルは削除できます。詳細については、「時系列テーブルの削除」をご参照ください。