hiexam
google · Professional-Cloud-Architect · Q425 · multiple_choice · topic_1

You write a Python script to connect to Google BigQuery from a Google Compute Engine virtual machine. The script is pri…

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?
  • 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.
Explanation
A - If client library was not installed, the python scripts won't run - since the question states the script reports "cannot connect" - the client library must have been installed. so it's B or C. B - https://cloud.google.com/bigquery/docs/authorization an access scope is how your client application retrieve access_token with access permission in OAuth when you want to access services via API call - in this case, it is possible that the python script use an API call instead of library, if this is true, then access scope is required. client library requires no access scope (as it does not go through OAuth) C - service account is Google Cloud's best practice So prefer C.

Reference: examtopics_top_comment

Practice with progress tracking

Sign in to track wrong answers, get spaced-repetition reminders, and run timed exam mode.