gpt4 book ai didi

python-3.x - 使用 BigQuery/Python3/Reddit "Project name needs to be separated by dot"错误

转载 作者:行者123 更新时间:2023-12-04 16:04:25 24 4
gpt4 key购买 nike

我有这段代码是用 python3 写的。

from google.cloud import bigquery
import json

timeframe = '2006'

client = bigquery.Client()

query_job = client.query("SELECT * FROM `fh-bigquery:reddit_comments.{}` LIMIT 05".format(timeframe))

results = query_job.result()

按照 https://cloud.google.com/bigquery/create-simple-app-api 中的说明设置环境变量后

set GOOGLE_APPLICATION_CREDENTIALS=[PATH]

我收到以下错误:

google.api_core.exceptions.BadRequest: 400 GET https://www.googleapis.com/bigquery/v2/projects
/ravischat-214114/queries/f936b73e-cf46-4fc5-b161-b05474c41560?maxResults=0:
Project name needs to be separated by dot from dataset name,
not by colon in table name "fh-bigquery:reddit_comments.2006".

任何解决错误的帮助将不胜感激!

如果我需要直接在代码中设置身份验证 JSON 文件的路径,如果有人能告诉我该怎么做,我将不胜感激。

最佳答案

根据显示的错误,更改:

`fh-bigquery:reddit_comments.2006`

到:

`fh-bigquery.reddit_comments.2006`

关于python-3.x - 使用 BigQuery/Python3/Reddit "Project name needs to be separated by dot"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51972502/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com