pandas_gbq 无法将标签附加到 bigquery 作业

问题描述 投票:0回答:1

我尝试将标签附加到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 的文档? 先谢谢你了

pandas google-bigquery
1个回答
0
投票

查看 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)
© www.soinside.com 2019 - 2024. All rights reserved.