全部產品
Search
文件中心

Tablestore:Python SDK ListTable樣本

更新時間:Jun 30, 2024
說明 Python SDK的安裝和操作,請參見Python SDK

ListTable程式碼範例如下:

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        

Python SDK文檔的程式碼範例中沒有引入tablestore包的提示,如果未引入tablestore包,則會出現如下提示,請引入tablestore包後運行即可。

Traceback (most recent call last):

  File “listtable.py”, line 6, in

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

NameError: name ‘OTSClient’ is not defined