All Products
Search
Document Center

Tablestore:Go SDK

Last Updated:Jan 15, 2025

This topic describes the prerequisites for using Tablestore SDK for Go and how to install and use Tablestore SDK for Go.

Background information

Tablestore supports multiple data models, such as the Wide Column model, the TimeSeries model, and the Timeline model. This SDK reference mainly describes how to use the Wide Column model and the TimeSeries model. Use Tablestore SDK for Go based on the data model of your Tablestore instance, as described in the following table.

Data model

Procedure

Wide Column model

You can perform the following steps to get started with the Wide Column model by using Tablestore SDK for Go:

  1. Install Tablestore SDK for Go. For more information, see Install Tablestore SDK for Go.

  2. Initialize an OTSClient instance to configure a Tablestore instance that you want to access. For more information, see Initialize an OTSClient instance.

  3. Create a data table to store data. For more information, see Operations on tables.

  4. Read data from and write data to the table. For more information, see Basic operations on data.

  5. Use indexes to accelerate data queries. For more information, see Search index and Secondary index.

  6. Use the SQL query feature to query data. For more information, see SQL query.

Use other features based on your business requirements.

  • If you want to migrate data or use compute engines to process data, use Tunnel Service. For more information, see Tunnel service.

  • If you want to deliver the data of Tablestore to Object Storage Service (OSS) in real time for storage and analysis, use the data delivery feature. For more information, see Data delivery.

TimeSeries model

You can perform the following steps to get started with the TimeSeries model by using Tablestore SDK for Go:

  1. Install Tablestore SDK for Go. For more information, see Install Tablestore SDK for Go.

  2. Initialize a TimeseriesClient instance to configure a Tablestore instance that you want to access. For more information, see Initialize an OTSClient instance.

  3. Create a time series table to store data. For more information, see Operations on time series tables.

  4. Read data from and write data to the table and retrieve and update time series. For more information, see Operations on time series data.

  5. Use the SQL query feature to query data. For more information, see SQL query.

Prerequisites

  • An AccessKey pair that consists of an AccessKey ID and an AccessKey secret is obtained. For more information, see Obtain an AccessKey pair.

  • Tablestore is activated. For more information, see Step 1: Activate Tablestore.

  • A Go environment is installed. We recommend that you install Go 1.4 or later.

Download Tablestore SDK for Go

Download Tablestore SDK for Go from GitHub, including the SDK installation package, source code, and examples. For more information, visit GitHub.

Version

Latest version: 1.7.17

References