2
我想在python中使用bigquery api來訪問數據,這裏是我的代碼。通過python中的BigQuery訪問數據
我已經把PEM文件相同的文件夾內,但腳本返回一個錯誤「googleapiclient.errors.HttpError:https://www.googleapis.com/bigquery/v2/projects/digin-1086/queries?alt = JSON返回「未找到:表DIGIN-1086:dataset.my_table」>
from bigquery import get_client
# BigQuery project id as listed in the Google Developers Console.
project_id = 'digin-1086'
# Service account email address as listed in the Google Developers Console.
service_account = '[email protected]count.com'
# PKCS12 or PEM key provided by Google.
key = 'Digin-d6387c00c5a'
client = get_client(project_id, service_account=service_account,
private_key_file=key, readonly=True)
# Submit an async query.
job_id, _results = client.query('SELECT * FROM dataset.my_table LIMIT 1000')
# Check if the query has finished running.
complete, row_count = client.check_job(job_id)
# Retrieve the results.
results = client.get_query_rows(job_id)
是的,這是一個愚蠢的錯誤 – Sajeetharan