Associate Data Practitioner · Free Practice Question Medium
Question 21
A data analyst needs to query data stored in multiple CSV files in Cloud Storage without loading them into BigQuery. Which approach should they use?
-
A
Create an external table in BigQuery pointing to the CSV files
-
B
Use Cloud SQL with federated queries to Cloud Storage
-
C
Create a Dataproc cluster and query with Spark SQL
-
D
Use Cloud Functions to read the files and output results
Reveal correct answer
Correct answer: A
Explanation
Option A is CORRECT. BigQuery external tables allow direct querying of data in Cloud Storage using standard SQL without loading the data into BigQuery storage. This approach provides immediate query capabilities with minimal setup, leverages BigQuery's powerful query engine, incurs no storage costs for the data in BigQuery, and automatically handles file format parsing. For a data analyst who needs to query CSV files directly, this is the simplest and most efficient solution.
Option B is INCORRECT. Cloud SQL doesn't provide built-in federated queries to Cloud Storage. This approach would require first loading the data into Cloud SQL, defeating the purpose of querying without loading, and adding unnecessary complexity and storage costs.
Option C is INCORRECT. While a Dataproc cluster with Spark SQL could query the CSV files, this approach requires setting up and maintaining Hadoop infrastructure, which is overly complex for the simple requirement of querying CSV files. It introduces unnecessary operational overhead and requires specialized skills compared to using BigQuery external tables.
Option D is INCORRECT. Cloud Functions aren't designed for data querying use cases. This approach would require writing custom code to parse CSV files and implement query logic, which is inefficient and lacks the SQL interface and optimization capabilities that BigQuery provides. It would be difficult to implement complex queries or work with large datasets using this approach.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
