英文:
Adding table description using pandas-gbq.to_gbq
问题
I am using the library pandas-gbq.to_gbq to create my tables on Google Big Query. Everything is working fine, except for the fact that I wasn't able to add the table description using this function (not column description). I've tried:
schema = {
"description": "Description here",
"fields": [
{
"name": "nome",
"type": "STRING",
"description": "Blablabla"
},
{
"name": "numero",
"type": "INT64",
"description": "Blablabla"
}
]
}
df = pd.DataFrame({"nome": ["Monique", "Rodrigo"],
"numero": [1, 2]})
df.to_gbq(table, project_id=project_id, if_exists="replace", table_schema=schema)
But I got the error:
TypeError: string indices must be integers
Is it possible to add the description using this function? Thanks!
英文:
I am using the library pandas-gbq.to_gbq to create my tables on Google Big Query. Everything is working fine, except for the fact that I wasn't able to add the table description using this function (not column description). I've tried:
schema = {
"description": "Description here",
"fields": [
{
"name": "nome",
"type": "STRING",
"description": "Blablabla"
},
{
"name": "numero",
"type": "INT64",
"description": "Blablabla"
}
]
}
df = pd.DataFrame({"nome": ["Monique", "Rodrigo"],
"numero": [1, 2]})
df.to_gbq(table, project_id=project_id,if_exists="replace", table_schema = schema)
But I got the error:
> TypeError: string indices must be integers
Is it possible to add the description using this function? Thanks!
答案1
得分: 0
就像@jagamts1在评论中写的那样:
> 我们无法使用gbq更新表的描述。一旦表被创建,您可以使用更新选项来更新表的描述。
> https://cloud.google.com/bigquery/docs/samples/bigquery-update-table-description?hl=pt-br
英文:
Like @jagamts1 have written in the comments:
> We can't update the table descriptions using gbq. Once the table is
> created, you can update the table description by update option.
> https://cloud.google.com/bigquery/docs/samples/bigquery-update-table-description?hl=pt-br
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论