使用ListTable介面擷取當前執行個體下已建立的所有表的表名。
说明 API說明請參見ListTable。
前提條件
- 已初始化OTSClient。更多資訊,請參見初始化。
- 已建立資料表。
介面
"""
說明:擷取所有表名的列表。
返回:表名列表。
``table_list``表示擷取的表名列表,類型為tuple,例如('MyTable1', 'MyTable2')。
"""
def list_table(self):
樣本
擷取執行個體下所有表的表名。
try:
list_response = ots_client.list_table()
print 'table list:'
for table_name in list_response:
print table_name
print "list table succeeded"
except Exception:
print "list table failed."
詳細代碼請參見ListTable@GitHub。