Bitzu

Associate Cloud Engineer ยท Operating databases and data jobs

Which tool queries which data service?

bq query, Cloud SQL connections, Spanner and Firestore query tools, Bigtable cbt, AlloyDB access; which tool for which service.

Key points

  • BigQuery: bq query.
  • Cloud SQL: gcloud sql connect INSTANCE --user=USER opens a client session.
  • Bigtable: the cbt tool (for example cbt read).
  • Spanner: gcloud spanner databases execute-sql or the console.
  • Pick the tool by the service, not by the SQL dialect.

Source: https://docs.cloud.google.com/sdk/gcloud/reference/sql/connect

Practice questions

Single choice

Which command runs a SQL query against BigQuery from the command line?

  1. bq query
  2. gcloud sql connect
  3. cbt read
  4. gcloud dataflow jobs run
Show answer

Answer: A. bq query

bq query is the BigQuery CLI entry point. gcloud sql connect targets Cloud SQL, and cbt targets Bigtable.

Select all that apply

Which tool-to-service pairings are correct?

  1. bq query for BigQuery tables
  2. gcloud sql connect for Cloud SQL instances
  3. cbt for Bigtable tables
  4. bq query for opening a session on a Cloud SQL instance
  5. gcloud sql connect for BigQuery datasets
Show answer

Answer: A. bq query for BigQuery tables, B. gcloud sql connect for Cloud SQL instances, C. cbt for Bigtable tables

bq query fits BigQuery, gcloud sql connect fits Cloud SQL and cbt fits Bigtable. The reverse pairings do not work: the tools are service specific.

True or false

gcloud sql connect can be used to query BigQuery datasets.

Show answer

Answer: False

False. gcloud sql connect only opens a session on a Cloud SQL instance. BigQuery is queried with bq query or the console.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More Associate Cloud Engineer topics in this module