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
Which command runs a SQL query against BigQuery from the command line?
- bq query
- gcloud sql connect
- cbt read
- 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.
Which tool-to-service pairings are correct?
- bq query for BigQuery tables
- gcloud sql connect for Cloud SQL instances
- cbt for Bigtable tables
- bq query for opening a session on a Cloud SQL instance
- 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.
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.
