英文:
Hitting BigQuery from Golang app fails with 400 status code
问题
我正在尝试从Golang应用程序对BigQuery进行SQL查询,但是出现以下错误:
googleapi: Error 400: Cannot parse as CloudRegion., badRequest
在调试请求时,我看到以下是有问题的请求:
curl --location --request POST 'https://bigquery.googleapis.com/bigquery/v2/projects/?????????/queries?alt=json&prettyPrint=false' \
--header 'Content-Type: application/json' \
--header 'User-Agent: google-api-go-client/0.5' \
--header 'X-Goog-Api-Client: gl-go/1.15.12 gccl/1.28.0' \
--data-raw '{"query":"SELECT distinct id from ?????","requestId":"request-20220308-70905360322000-0001","useLegacySql":false}
我在文档中找不到这个错误。有人可以指导我正确的方向吗?
英文:
I am trying to make a SQL query against BigQuery from a Golang applications. It does not work and throws the below error :
googleapi: Error 400: Cannot parse as CloudRegion., badRequest
While debugging the request the library is doing I see this is the request in question:
curl --location --request POST 'https://bigquery.googleapis.com/bigquery/v2/projects/?????????/queries?alt=json&prettyPrint=false' \
--header 'Content-Type: application/json' \
--header 'User-Agent: google-api-go-client/0.5' \
--header 'X-Goog-Api-Client: gl-go/1.15.12 gccl/1.28.0' \
--data-raw '{"query":"SELECT distinct id from ?????","requestId":"request-20220308-70905360322000-0001","useLegacySql":false}
I cant find this error anywhere on the documentation. Can someone guide me in the right direction with this?
答案1
得分: 1
我知道你面临的错误有两种可能性,可能是以下两种情况之一:
-
projectId 不正确或者是一个不存在的项目。
-
认证凭据没有正确设置,你可以查看文档中的这部分内容来进行设置。
英文:
I know that the error you are facing has two possibilities, that could be happening to you.
-
The projectId is incorrect or is a non-existing project.
-
The authentication credentials are not set up correctly, for this you
can see this part of the
documentation.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论