1
您好我在datalab上使用ipython筆記本時遇到問題。Datalab不會填充bigQuery表格
我想寫一個表的結果到一個bigQuery表中,但它不工作,任何人都說使用insert_data(dataframe)函數,但它不填充我的表。 爲了簡化問題,我嘗試讀取表並將其寫入剛創建的表(具有相同的模式),但不起作用。誰能告訴我我錯在哪裏?
import gcp
import gcp.bigquery as bq
#read the data
df = bq.Query('SELECT 1 as a, 2 as b FROM [publicdata:samples.wikipedia] LIMIT 3').to_dataframe()
#creation of a dataset and extraction of the schema
dataset = bq.DataSet('prova1')
dataset.create(friendly_name='aaa', description='bbb')
schema = bq.Schema.from_dataframe(df)
#creation of the table
temptable = bq.Table('prova1.prova2').create(schema=schema, overwrite=True)
#I try to put the same data into the temptable just created
temptable.insert_data(df)