Accessing NOAA Data via BigQuery

自闭症网瘾萝莉.ら 提交于 2021-01-29 15:53:38

问题


I am trying to access the NOAA Data via BigQuery. I used the following code to achieve the same :

import os
from google.oauth2 import service_account

credentials = service_account.Credentials.from_service_account_file("my-json-file-path-with-filename.json")

from google.cloud import bigquery
# Create a "Client" object
client = bigquery.Client(credentials=credentials)

But getting the following error :

DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started

Can somebody please help. I have already created my service account but still facing this issue.


回答1:


import os from google.cloud.bigquery.client import Client

os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'path_to_json_file' bq_client = Client()



来源:https://stackoverflow.com/questions/61364931/accessing-noaa-data-via-bigquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!