我有两个项目。Project Apple 在 BQ 表中有数据。Project Banana 对 Apple 的 BQ 表具有读取权限。当我使用 Banana 的 BQ UI 运行查询时,一切都很好。相同的查询在 Banana 的 AI 笔记本中不起作用。
香蕉 BQ 用户界面:
AVG(A) as A_mean_exact,
APPROX_QUANTILES(A, 100)[OFFSET(50)] AS A_percentile_50_approx,
APPROX_QUANTILES(A, 100)[OFFSET(90)] AS A_percentile_90_approx
FROM `apple.v1003.apple_table`
WHERE selected_run = 1
工作正常。
Banana 的 AI 笔记本:
from google.cloud import bigquery
client = bigquery.Client(location="US", project="banana") # I also tried apple; same error
print("Client creating using default project: {}".format(client.project))
Client creating using default project: banana
query = """
SELECT
AVG(A) as A_mean_exact,
APPROX_QUANTILES(A, 100)[OFFSET(50)] AS A_percentile_50_approx,
APPROX_QUANTILES(A, 100)[OFFSET(90)] AS A_percentile_90_approx
FROM `apple.v1003.apple_table`
WHERE selected_run = 1
"""
query_job = client.query(
query,
location="US",
)
df = query_job.to_dataframe()
df
Forbidden: 403 Access Denied: Table apple:v1003.apple_table: User does not have permission to query table apple:v1003.apple_table.
你能建议我应该研究什么吗?我刚开始使用 AI Hub。