All Products
Search
Document Center

Tablestore:Overview

Last Updated:Sep 27, 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 configure a Tablestore instance that you want to access. 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

Important
  • Tablestore SDK for Python V6.0.0 or later supports Python 3 and no longer supports Python 2.

    We recommend that you use the following Python 3 versions: Python 3.8, Python 3.9, Python 3.10, Python 3.11, and Python 3.12.

  • If you want to use Python 2, we recommend that you use Tablestore SDK for Python V5.4.4 or earlier.

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

Compatibility

The latest version of Tablestore SDK for Python is 6.x.x. The following items describe the compatibility between the latest version and previous 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