无法将查询保存为视图表 [英] Unable to save a query as a view table

查看:100
本文介绍了无法将查询保存为视图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个查询运行并可以看到结果。但在尝试将查询保存为视图表时,我收到错误消息:


无法保存视图。未找到合适的凭据来访问Google
云端硬盘。请联系表主人寻求帮助。


我认为问题是由查询中使用的表引起的。该表格是由我自己的Google表格(带有源URI)上传的。我试图从该项目启用Google Drive API,但没有运气。不知道如何让BigQuery访问Google Drive。

解决方案

我怀疑您遇到的问题是OAuth Scopes之一。为了与Google Drive API对话以读取数据,您需要使用被授权访问该API的凭据。



如果您使用的是BigQuery Web UI,并且尚未明确授予对云端硬盘的访问权限,因此无法使用。例如,第一次尝试保存到Google表格时,BigQuery用户界面弹出了一个OAuth提示,要求我授予我的Google云端硬盘访问权限。之后它可以保存结果。尝试这样做以确保您的凭据具有Drive范围,然后再次保存视图。



如果您使用自己的代码来执行此操作,则应该请求范围'https://www.googleapis.com/auth/drive'除了'https://www.googleapis.com/auth / bigquery'范围,您已经在使用它与BigQuery交谈。



如果您使用 bq 客户端,它已被更新为请求这个范围,但您可能需要重新初始化您的认证凭证。您可以使用 bq init --delete_credentials 来移除证书,然后再次请求证书。

I have a query that runs and can see the results. But while trying to save the query as a view table, I get error message saying

Failed to save view. No suitable credentials found to access Google Drive. Contact the table owner for assistance.

I think the problem is caused by a table used in the query. The table is uploaded from a google sheet (with source URI), own by me. I have tried to enable Google Drive API from the project but no luck. Not sure how I can give BigQuery access to Google Drive.

解决方案

I suspect the problem you are hitting is one of OAuth Scopes. In order to talk to the Google Drive API to read data, you need to use credentials that were granted access to that API.

If you are using the BigQuery web UI and have not explicitly granted access to Drive, it won't work. For example, the first time I tried to "Save to Google Sheets", the BigQuery UI popped up an OAuth prompt asking me to grant access to my Google Drive. After this it could save the results. Try doing this to make sure your credentials have the Drive scope and then "Save View" again.

If you are using your own code to do this, you should request scope 'https://www.googleapis.com/auth/drive' in addition to the 'https://www.googleapis.com/auth/bigquery' scope you are already using to talk to BigQuery.

If you are using the bq client, it has been updated to request this scope, but you may need to re-initialize your authentication credentials. You can do this with bq init --delete_credentials to remove the credentials, then your next action we re-request credentials.

这篇关于无法将查询保存为视图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆