BigQuery API是否有一些重大变化

时间:2017-12-21 02:30:20

标签: google-bigquery

两个月前,我很好地运行了以下代码,但现在,在我再次安装google.cloud之后,它被说:' TableReference'对象没有属性"存在" ,要么我不能使用Dataset.name,它也不见了。关于API声音有任何重大变化,比如我需要重构我的代码......

def createTable(client, ds, tb):
    dataset = client.dataset(ds)
   #assert not dataset.exists()
    table = dataset.table(tb)
    #assert not table.exists()
    if not table.exists():
        assert not table.exists()
        table.schema = (bigquery.SchemaField('Name', 'STRING'),
                        bigquery.SchemaField('Age', 'INTEGER'),
                        bigquery.SchemaField('Weight', 'FLOAT'),)
        table.create()
    else:
        print 'this table already existed in this dataset'
        assert table.exists()

1 个答案:

答案 0 :(得分:2)

您可能暂时没有更新,并且您从0.28.0引入了重大更改,特别是:

  

删除table.exists()(#4145)

  

创建,获取,更新,删除数据集和表格的功能   客户类。

请参阅:

总之,您需要迁移/移植代码,或者保留旧版本。