我尝试将标签附加到bigquery作业,这应该通过Bigquery API来工作,例如:
df = pd.read_gbq(sql, project_id=project_id, dialect='standard', configuration=query_config)
query_config = {
"query": {
"labels": {
"label": "labelName"
}
}
}
但它根本不会贴标签。
虽然谷歌的bigquery连接器工作完美:
df = client.query(sql, job_config=query_config, project=project_id).to_dataframe()
query_config = bigquery.QueryJobConfig(
labels={
'label': 'labelName'
}
)
我是否误读了 BigQuery API 的文档? 先谢谢你了
查看 REST 请求的结构:https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest
labels
字段不应位于query
字段内:
config = {
"labels": {
"label": "labelName"
}
}
df = pd.read_gbq(sql, project_id=project_id, dialect='standard', configuration=config)