All Products
Search
Document Center

Tablestore:Go SDK

Last Updated:Jul 02, 2025

Tablestore SDK for Go supports operations on the Wide Column model, TimeSeries model, and Timeline model.

Features

Before you use the SDK features, you must initialize a client. For more information about the features supported by the Go SDK, see the following table.

Note

For more information about the Timeline model, see Timeline model.

Wide Column model

Feature type

Operation

Description

Table operations

Create a table

You can create a data table to store data. You can configure data encryption and an auto-increment primary key column when you create a data table.

Update table configurations

You can update the configuration information of a table, such as the time to live (TTL) and max versions.

List tables

You can query the names of all tables in an instance.

Query table information

You can query the configurations of a table.

Delete a table

You can delete a table.

Data operations

Write data

You can write data to a data table in Tablestore. For example, you can write a single row of data, update a single row of data, and write multiple rows of data at the same time.

Read data

You can read data from a data table in Tablestore. For example, you can read a single row of data, read multiple rows of data at the same time, and read data whose primary key values are within a specific range.

Delete data

You can delete data from a data table in Tablestore. For example, you can delete a single row of data or delete multiple rows of data at the same time.

Filter

After you configure a filter, query results are filtered on the server side based on the filter conditions. Only rows of data that meet the filter conditions are returned.

Conditional update

If you use conditional update, data in a table can be updated only when the conditions are met. Otherwise, the update fails and an error message is returned.

Atomic counter

The atomic counter feature allows you to specify a column as an atomic counter and perform atomic counter operations on the column.

Local transaction

After you enable local transaction for a data table, you can create a local transaction based on a partition key value. You can read and write data in the local transaction and then commit or discard the local transaction based on your business requirements.

Search index

Create a search index

You can create a search index for a data table.

List search indexes

Query search indexes that are created for a table.

Update search index configurations

Update the time to live (TTL) of a search index.

Query search index description

Query the description of a search index, including the information about the fields in the search index and configurations of the search index.

Delete a search index

You can delete a search index that you no longer need.

Specify the TTL of a search index

Delete historical data or extend the retention period of data in a search index based on business requirements.

Basic query

Basic query types include match all query, term query, terms query, prefix query, wildcard query, range query, exists query, collapse (distinct), geo query, and nested query.

Boolean query

Query conditions can contain one or more subconditions. Tablestore determines whether data meets the query conditions based on the subconditions.

Sorting and paging

When you use a search index to query data, you can specify a sorting method for the returned data. When many rows are returned, you can use offset-based paging or token-based paging to quickly locate the required data.

Aggregation

You can perform aggregation operations to obtain the minimum value, maximum value, sum, average value, and count and distinct count of rows. You can also perform aggregation operations to group results by field value, range, geographical location, or filter. You can perform multiple aggregation operations for complex queries.

Full-text search

Tablestore provides match query and match phrase query to implement full-text search. When you perform a query, data is matched based on tokenization. You can also use the highlight feature to highlight query strings.

KNN vector query

You can use the k-nearest neighbor (KNN) vector query feature to perform an approximate nearest neighbor search based on vectors. This way, you can find data items that have the highest similarity to the vector that you want to query in a large-scale dataset.

Parallel scan

If you do not want to sort the entire result set, you can use the parallel scan feature to return all matched data at a faster speed.

Secondary index

Create a secondary index

You can create a secondary index for a data table.

Use a secondary index to read data

You can query data in a secondary index by reading a single row of data or reading data whose primary key values are within a specific range. If the required attribute columns are included in the secondary index, data can be directly read from the secondary index. Otherwise, data must be read from the data table.

Delete a secondary index

You can delete a specified secondary index from a data table.

Tunnel Service

Create a tunnel

You can create a tunnel for a data table for real-time data consumption.

Query information about all tunnels of a data table

You can list the information about all tunnels in a data table, such as the tunnel name, tunnel type, tunnel ID, tunnel stage, and whether the data is expired.

Query information about a tunnel

You can obtain specific information about a tunnel, such as tunnel information and channel information in the tunnel.

Delete a tunnel

You can delete a tunnel from a data table.

SQL query

Create a mapping table

You can create a mapping table for an existing table or index.

Update attribute columns in a mapping table

Add or remove attribute columns in an existing mapping table.

Delete a mapping table

Delete one or more mapping tables.

List mapping table names

You can list the mapping tables in the current database.

Query table description

You can query the description of a table, such as field names and field types.

Query index description

You can query the index description of a table.

Query data

Query data in a table.

Query the date and time data

After you query time type data (including Datetime, Date, and Time) by using SQL statements, you can obtain specific data based on your requirements.

Data lake shipping

Create a delivery task

You can create a delivery task to ship data from a Tablestore data table to an OSS bucket for storage.

List delivery task names

You can list all delivery task information for a data table, such as the table name, delivery task name, and delivery task type.

Query delivery task description

Query the descriptive information of a delivery task.

Delete a delivery task

Delete a delivery task.

TimeSeries model

Feature type

Operation

Description

Time series table operations

Create a time series table

Create a time series table to store time series data.

Update a time series table

You can update configurations of a time series table or time series metadata.

List time series table names

You can view the names and configuration information of all time series tables in an instance.

Query time series table description

Query the information about a time series table, such as the TTL configuration.

Delete a time series table

Delete a time series table.

Time series data operations

Write time series data

You can write time series data to a time series table in a batch.

Query time series data

Query the time series data that meets the specified conditions in a specific time series.

Time series operations

Retrieve time series

You can specify multiple conditions to retrieve time series information, such as the metric name and data source information.

Update time series

You can update time series metadata in a batch.

Delete time series

You can delete time series metadata in a batch.

Time series analytical store

Create an analytical store

You can create an analytical store for an existing time series table.

Update the TTL of an analytical store

Update the time to live (TTL) configuration for the data in an analytical store. After you update the TTL of an analytical store, Tablestore automatically cleans up data whose retention period exceeds the TTL of the analytical store asynchronously.

Query information of an analytical store

You can query the description of an analytical store, such as the TTL configuration, data synchronization options, data synchronization status, and data storage size.

Delete an analytical store

You can delete an analytical store from a time series table.

Lastpoint index

Create a Lastpoint index

You can create a Lastpoint index for a time series table to quickly retrieve the latest time point data of each time series.

Query Lastpoint index data

You can query data in a Lastpoint index.

Retrieve a Lastpoint index

You can use a search index that is created for a Lastpoint index to retrieve data in the Lastpoint index. Search indexes can be used to accelerate data retrieval for Lastpoint indexes and provide multi-dimensional query and statistical analysis capabilities.

Delete a Lastpoint index

You can delete a Lastpoint index that you no longer require.

SQL query

Create a mapping table

You can create a mapping table for an existing table or index.

Update attribute columns in a mapping table

Add or remove attribute columns in an existing mapping table.

Delete a mapping table

Delete one or more mapping tables.

List mapping table names

You can list the mapping tables in the current database.

Query table description

You can query the description of a table, such as field names and field types.

Query index description

You can query the index description of a table.

Query data

Query data in a table.

Version compatibility

The latest version is 1.17.x, which is compatible with all previous versions.

For more information about SDK version iterations, see Version history of Tablestore SDK for Go.

References

For more information about how to handle errors in Tablestore, see Error handling.