如何在python中从以下内容获取表名
我使用带python的大查询客户机从大查询中检索表名如何在python中从以下内容获取表名,python,json,google-bigquery,Python,Json,Google Bigquery,我使用带python的大查询客户机从大查询中检索表名 result = client._get_all_tables(datasetID,cache=False) print result for x in result: 结果如下: {u'totalItems': 7, u'tables': [{u'kind': u'bigquery#table', u'type': u'TABLE', u'id': u'publicdata:samples.github_nested'
result = client._get_all_tables(datasetID,cache=False)
print result
for x in result:
结果如下:
{u'totalItems': 7, u'tables': [{u'kind': u'bigquery#table', u'type': u'TABLE', u'id': u'publicdata:samples.github_nested', u'tableReference': {u'projectId': u'publicdata', u'tableId': u'github_nested', u'datasetId': u'samples'}}, {u'kind': u'bigquery#table', u'type': u'TABLE', u'id': u'publicdata:samples.github_timeline', u'tableReference': {u'projectId': u'publicdata', u'tableId': u'github_timeline', u'datasetId': u'samples'}}, {u'kind': u'bigquery#table', u'type': u'TABLE', u'id': u'publicdata:samples.gsod', u'tableReference': {u'projectId': u'publicdata', u'tableId': u'gsod', u'datasetId': u'samples'}}, {u'kind': u'bigquery#table', u'type': u'TABLE', u'id': u'publicdata:samples.natality', u'tableReference': {u'projectId': u'publicdata', u'tableId': u'natality', u'datasetId': u'samples'}}, {u'kind': u'bigquery#table', u'type': u'TABLE', u'id': u'publicdata:samples.shakespeare', u'tableReference': {u'projectId': u'publicdata', u'tableId': u'shakespeare', u'datasetId': u'samples'}}, {u'kind': u'bigquery#table', u'type': u'TABLE', u'id': u'publicdata:samples.trigrams', u'tableReference': {u'projectId': u'publicdata', u'tableId': u'trigrams', u'datasetId': u'samples'}}, {u'kind': u'bigquery#table', u'type': u'TABLE', u'id': u'publicdata:samples.wikipedia', u'tableReference': {u'projectId': u'publicdata', u'tableId': u'wikipedia', u'datasetId': u'samples'}}], u'kind': u'bigquery#tableList', u'etag': u'"hnk59tKBkX8cdlePZ8VtzgVzuO4/2P51RdhDvk7tUvXpY_uairNEWDE"'}
如何从上面的字典列表中获取表名
预期输出:
github_nested
github_timeline
gsod
natality
shakespeare
trigrams
wikipedia
我是这样做的
tablesWithDetails = result["tables"]
print tablesWithDetails
for inditable in tablesWithDetails:
tables.append(inditable["id"])
return tables