Google Cloud Professional Cloud Architect — Question 238
You write a Python script to connect to Google BigQuery from a Google Compute Engine virtual machine. The script is printing errors that it cannot connect to
BigQuery.
What should you do to fix the script?
Answer options
- A. Install the latest BigQuery API client library for Python
- B. Run your script on a new virtual machine with the BigQuery access scope enabled
- C. Create a new service account with BigQuery access and execute your script with that user
- D. Install the bq component for gcloud with the command gcloud components install bq.
Correct answer: C
Explanation
The correct answer is C because creating a new service account with BigQuery access ensures that the script has the necessary permissions to connect to BigQuery. Option A does not directly address authorization issues, and while option B may help, it doesn't guarantee the correct permissions without configuring the service account. Option D is irrelevant as it pertains to installing a command-line tool rather than fixing the script's connection issue.