Note For information about how to install and use Tablestore SDK for Python, see Overview in Tablestore SDK for Python.

Examples

import time

import logging

import unittest

from tablestore import *

ENDPOINT = "https://xxx.cn-hangzhou.ots.aliyuncs.com";

ACCESSID = "xxx";

ACCESSKEY = "xxx";

INSTANCENAME = "xxx";

ots_client = OTSClient(ENDPOINT, ACCESSID, ACCESSKEY, INSTANCENAME)

list_response = ots_client.list_table()

print u'instance table:'

for table_name in list_response:

    print table_name        

The error message that appears when the Tablestore package is not imported is not provided in the documentation of Tablestore SDK for Python. If the Tablestore package is not imported, the following error message appears. After the Tablestore package is imported, you can run the code.

Traceback (most recent call last):

  File "listtable.py", line 6, in

    ots_client = OTSClient(ENDPOINT, ACCESSID, ACCESSKEY, INSTANCENAME)

NameError: name 'OTSClient' is not defined