我有一个可在控制台云Google平台中使用的查询:
select visitorId
from `data-set-id.ga_sessions_20180801` as ga, UNNEST(ga.hits) AS hits
我需要在python代码中执行它,如果我尝试使用google-api-python-client(v 1.5.0)执行此操作,我总是会收到错误消息:
1-
select fullVisitorId FROM [data-set-id.ga_sessions_20180801] as ga, UNNEST(hits) AS hits
我得到:
googleapiclient.errors.HttpError:https://www.googleapis.com/bigquery/v2/projects/project-id/queries?alt=json 返回“未找到:表project-id:data-set-id.hits“>
2-
select fullVisitorId FROM [data-set-id.ga_sessions_20180801] as ga,UNNEST(ga.hits) AS hits
我得到:
googleapiclient.errors.HttpError:https://www.googleapis.com/bigquery/v2/projects/project-id/queries?alt=json 返回“未找到:数据集project-id:ga“>
3-
select fullVisitorId FROM [data-set-id.ga_sessions_20180801] as ga, UNNEST(ga_sessions_20180801.hits) AS hits
我得到:
googleapiclient.errors.HttpError:https://www.googleapis.com/bigquery/v2/projects/project-id/queries?alt=json 返回“未找到:数据集 project-id:ga_sessions_20180801“>
4-
select fullVisitorId FROM [data-set-id.ga_sessions_20180801] as ga, UNNEST(data-set-id.ga_sessions_20180801.hits) AS hits
我得到:
googleapiclient.errors.HttpError:https://www.googleapis.com/bigquery/v2/projects/project-id/queries?alt=json 在第4行第24列返回“遇到”。“>
我用来称呼它的代码:
bigquery_service = googleapiclient.discovery.build( 'bigquery', 'v2', credentials=credentials)
bigquery_service.jobs().query( projectId=self.project_id, body={"maxResults": max_results, "defaultDataset": {"projectId": self.project_id, "datasetId": data_set_id}, "query": query})
我尝试了更多尝试,但结果相同...有任何想法吗?