Tous les produits
Search
Centre de documentation

Tablestore:Interroger les informations d'une table de séries temporelles

Dernière mise à jour :Aug 18, 2026

Prérequis

Exemple

L'exemple suivant appelle la méthode DescribeTimeseriesTable pour récupérer les métadonnées de la table de séries temporelles, notamment le nom de la table, la durée de vie (TTL) et les informations sur le magasin analytique.

func DescribeTimeseriesTableSample(client *tablestore.TimeseriesClient, timeseriesTableName string) {
    fmt.Println("[Info]: Begin to require timeseries table description!")
    describeTimeseriesTableRequest := tablestore.NewDescribeTimeseriesTableRequset(timeseriesTableName) // Construct a request and specify the name of the time series table.

    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: ")
    fmt.Println("[Info]: TimeseriesTableName: ", describeTimeseriesTableResponse.GetTimeseriesTableMeta().GetTimeseriesTableName())
    fmt.Println("[Info]: TimeseriesTable TTL: ", describeTimeseriesTableResponse.GetTimeseriesTableMeta().GetTimeseriesTableOPtions().GetTimeToLive())
    //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)
        }
        if analyticalStore.SyncOption != nil {
            fmt.Println("[Info]: SyncOption: ", *analyticalStore.SyncOption)
        }
    }
}

Références