# aliyun-tablestore-python-sdk
**Repository Path**: mirrors_aliyun/aliyun-tablestore-python-sdk
## Basic Information
- **Project Name**: aliyun-tablestore-python-sdk
- **Description**: Aliyun Tablestore (原OTS) Python SDK
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-08
- **Last Updated**: 2025-10-18
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
Aliyun Tablestore SDK for Python
==================================
.. image:: https://img.shields.io/badge/license-apache2-brightgreen.svg
:target: https://travis-ci.org/aliyun/aliyun-tablestore-python-sdk
.. image:: https://badge.fury.io/gh/aliyun%2Faliyun-tablestore-python-sdk.svg
:target: https://travis-ci.org/aliyun/aliyun-tablestore-python-sdk
.. image:: https://travis-ci.org/aliyun/aliyun-tablestore-python-sdk.svg
:target: https://travis-ci.org/aliyun/aliyun-tablestore-python-sdk
概述
----
- 此 Python SDK 基于 `阿里云表格存储服务 `_ API 构建。
- 阿里云表格存储是构建在阿里云飞天分布式系统之上的 NoSQL 数据存储服务,提供海量结构化数据的存储和实时访问。
运行环境
---------
- 安装 Python 即可运行,支持 python3.8、Python3.9、python3.10、python3.11、python3.12。
安装方法
---------
PIP安装
--------
.. code-block:: bash
$ pip install tablestore
Github安装
------------
1. 下载源码
.. code-block:: bash
$ git clone https://github.com/aliyun/aliyun-tablestore-python-sdk.git
2. 构建 whl (构建好的whl文件在dist目录下)
.. code-block:: bash
$ poetry build
3. 安装
.. code-block:: bash
$ pip install dist/tablestore-{替换为实际版本}-py3-none-any.whl
源码安装
--------
1. 下载 SDK 发布包并解压
2. 构建 whl (构建好的whl文件在dist目录下)
.. code-block:: bash
$ poetry build
3. 安装
.. code-block:: bash
$ pip install dist/tablestore-{替换为实际版本}-py3-none-any.whl
示例代码
---------
表(Table)示例:
- `表操作(表的创建、获取、更新和删除) `_
- `单行写(向表内写入一行数据) `_
- `单行读(从表内读出一样数据) `_
- `更新单行(更新某一行的部分字段) `_
- `删除某行(从表内删除某一行数据) `_
- `批量写(向多张表,一次性写入多行数据) `_
- `批量读(从多张表,一次性读出多行数据) `_
- `范围扫描(给定一个范围,扫描出该范围内的所有数据) `_
- `主键自增列(主键自动生成一个递增ID) `_
- `全局二级索引 `_
- `局部事务(提交事务) `_
- `局部事务(舍弃事务) `_
多元索引(Search)示例:
- `基础搜索 `_
- `并发圈选数据 `_
- `全文检索 `_
- `向量检索 `_
- `Max/Min/Sum/Avg/Count/DistinctCount 等 `_
- `GroupBy/Histogram 等 `_
执行测试
---------
**注意:测试 case 中会有清理某个实例下所有表的动作,所以请使用专门的测试实例来测试。**
1. 设置执行Case的配置
.. code-block:: bash
$ export OTS_TEST_ACCESS_KEY_ID=
$ export OTS_TEST_ACCESS_KEY_SECRET=
$ export OTS_TEST_ENDPOINT=
$ export OTS_TEST_INSTANCE=
2. 运行case
.. code-block:: bash
$ poetry run pytest tests
贡献代码
--------
- 我们非常欢迎大家为 Tablestore Python SDK 以及其他 Tablestore SDK 贡献代码。
- 非常感谢 `@Wall-ee `_ 对 4.3.0 版本的贡献。
联系我们
--------
- `阿里云 Tablestore 官方网站 `_
- `阿里云官网联系方式 `_
- `阿里云 Tablestore 官方文档 `_