Filipe Ferminiano
Filipe Ferminiano

Reputation: 8791

bigquery got multiple values for keyword argument 'project'

I'm trying to connect with Google BigQuery but I'm getting this error:

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

This is how I'm doing:

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 is his 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"
}

Upvotes: 0

Views: 697

Answers (1)

Logovskii Dmitrii
Logovskii Dmitrii

Reputation: 2943

Just fix a small error

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

This problem is the from_service_account_json function accept only 1 not named argument all other arguments should be passed as named

Upvotes: 1

Related Questions