对于这个问题的复杂性,我深表歉意,真的很感谢大家的帮助。我目前正在尝试按照谷歌教程在Jupyter notebook (https://cloud.google.com/bigquery/docs/visualize-jupyter)中可视化BigQuery数据。我有权限使用Project-1,但不能使用Project-2。
当我执行前两个命令时:
%load_ext google.cloud.bigquery
%%bigquery
SELECT
source_year AS year,
COUNT(is_male) AS birth_count
FROM `bigquery-public-data.samples.natality`
GROUP BY year
ORDER BY year DESC
LIMIT 15
...I获取以下格式的错误:
Caller does not have required permission to use project Project-2
但是,当我在笔记本中运行!gcloud config list
时,它列出了以下内容(以及正确的电子邮件帐户)
[accessibility]
screen_reader = true
[core]
disable_usage_reporting = True
project = Project-1
Your active configuration is: [default]
我是否错误地理解了%load_ext google.cloud.bigquery
语句的工作方式?谢谢!
发布于 2020-02-25 08:59:11
转到project selector page并选择项目Project-2
,然后在云shell中运行gcloud config set project Project-2
命令。然后,查看API & Services -> Credentials
部分,如果您创建了任何凭据,这将允许您访问已启用的API,请查看here。
您还可以执行gcloud auth login
来指定要使用的凭据。使用与您登录到Google Cloud控制台相同的帐户。
BigQuery Python客户端库支持查询存储在BigQuery中数据。%load_ext google.cloud.bigquery
是众多Jupyter内置命令之一,用于从客户端库加载命令。
让我知道结果。我希望它能对你有所帮助。
https://stackoverflow.com/questions/60382616
复制