2017-07-03 34 views
0

我試圖與谷歌的BigQuery連接,但我得到這個錯誤多個值:的BigQuery得到了關鍵字參數「項目」

ERROR api Query failure: __init__() got multiple values for keyword argument 'project' 

這是怎麼了我做:

from google.cloud import bigquery 


CREDENTIALS_BIGQUERY = dotenv.get_key(dotenv_path, 'CREDENTIALS_BIGQUERY') 

bigquery_client = bigquery.Client.from_service_account_json(CREDENTIALS_BIGQUERY, 'project-id123') 

CREDENTIALS_BIGQUERY是他的JSON:

{ 
    "type": "service_account", 
    "project_id": "roas-xxx", 
    "private_key_id": "xxxx", 
    "private_key": "xxxxn-----END PRIVATE KEY-----\n", 
    "client_email": "[email protected]", 
    "client_id": "xxxx", 
    "auth_uri": "https://accounts.google.com/o/oauth2/auth", 
    "token_uri": "https://accounts.google.com/o/oauth2/token", 
    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/cxxxerts", 
    "client_x509_cert_url": "https://www.googleapis.com/xxx" 
} 

回答

1

只是解決一個小錯誤

bigquery.Client.from_service_account_json(CREDENTIALS_BIGQUERY, project='project-id123') 

這個問題是from_service_account_json函數只接受1未命名的參數,所有其它參數應該傳遞作爲命名

相關問題