All Products
Search
Document Center

Tablestore:Overview

Last Updated:Jan 19, 2024

This topic describes how to install and use Tablestore SDK for Python and introduces the version compatibility of the SDK.

Procedure

Tablestore provides a variety of data models, such as the Wide Column model, the TimeSeries model, and the Timeline model. Tablestore SDK for Python supports only the Wide Column model.

You can perform the following steps to use the Wide Column model:

  1. Initialize an OTSClient instance to access a Tablestore instance. For more information, see Initialize an OTSClient instance.

  2. Create a data table to store data. For more information, see Table.

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

  4. Use indexes to accelerate data queries. For more information, see Search Index and Secondary Index.

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

Download Tablestore SDK for Python

You can download Tablestore SDK for Python from GitHub.

For more information about the version history of Tablestore SDK for Python, see Version history of Tablestore SDK for Python.

Compatibility

The latest version of Tablestore SDK for Python is V5.X.X. The following list describes the compatibility of the latest version with earlier versions:

  • Tablestore SDK for Python V5.X.X: compatible.

    Tablestore SDK for Python V5.4.X and V5.3.X are compatible with Tablestore SDK for Python V5.2.X. Tablestore SDK for Python V5.2.1 is incompatible with Tablestore SDK for Python V5.1.0 in the following aspects:

    • The type of the results returned by the Search operation is different between the two versions.

      By default, in Tablestore SDK for Python V5.1.0 or earlier, results of the Tuple type are returned. By default, in Tablestore SDK for Python V5.2.0 or later, the SearchResponse object is returned. SearchResponse supports the __iter__ method to traverse data. You can use the SearchResponse.v1_response() method to return results of the Tuple type.

    • Tablestore SDK for Python V5.2.1 supports the ParallelScan operation.

      By default, the return results of the ParallelScan operation are the ParallelScanResponse object. You can use the ParallelScanResponse.v1_response() method to return results of the Tuple type.

  • Tablestore SDK for Python V4.X.X: compatible.

  • Tablestore SDK for Python V2.X.X: incompatible. Tablestore SDK for Python V2.X.X supports primary key columns in random order, which are no longer supported in Tablestore SDK for Python V4.0.0 or later. Tablestore SDK for Python V4.X.X and Tablestore SDK for Python V2.X.X are incompatible in the following aspects:

    • The package name is changed from ots2 to tablestore.

    • The TableOptions parameter is added for the Client.create_table operation.

    • The type of the primary_key parameter is changed from dict to list for the put_row, get_row, and update_row operations to ensure the sequence of primary key columns.

    • The type of the attribute_columns parameter is changed from dict to list for the put_row and update_row operations.

    • The timestamp parameter is added to the attribute_columns parameter for the put_row and update_row operations.

    • The max_version and time_range parameters are added for the get_row and get_range operations. You must specify at least one of max_version and time_range.

    • The return_type parameter is added for the put_row, update_row, and delete_row operations. Only RT_PK is supported to return the primary key columns of the rows that meet the query conditions.

    • The return_row parameter is added for the put_row, update_row, and delete_row operations. If you set the return_type parameter to RT_PK in the request, the primary key columns of the rows that meet the query conditions are included in return_row.

For more information, see Version history of Tablestore SDK for Python.

References