SOL-C01 · Question #127
You are tasked with loading data from a series of CSV files stored in an Amazon S3 bucket into Snowflake. The CSV files contain a header row, but some files have slight variations in the number and or
The correct answer is C. Create a single target table with all possible columns from all CSV files, using 'SKIP_HEADER = 1'. Option C is correct because creating a single target table that includes all possible columns across every file variant, combined with SKIP_HEADER = 1, lets Snowflake's COPY INTO command skip the header row and map data using column-name matching (MATCH_BY_COLUMN_NAME = CASE_INSE
Question
You are tasked with loading data from a series of CSV files stored in an Amazon S3 bucket into Snowflake. The CSV files contain a header row, but some files have slight variations in the number and order of columns. You want to ensure that all relevant data is loaded correctly, even if the column order differs, and that any extra columns are ignored. Which of the following approaches is the MOST appropriate and efficient?
Options
- ACreate a separate external table for each CSV file with a different column structure.
- BDefine a single external table with a VARIANT column and use Snowflake's CSV parsing
- CCreate a single target table with all possible columns from all CSV files, using 'SKIP_HEADER = 1'
- DCreate a VIEW on top of the external table to ensure that column names are consistent across all
- EPre-process the CSV files to standardize the column order and names before loading them into
How the community answered
(26 responses)- A4% (1)
- B19% (5)
- C65% (17)
- D4% (1)
- E8% (2)
Explanation
Option C is correct because creating a single target table that includes all possible columns across every file variant, combined with SKIP_HEADER = 1, lets Snowflake's COPY INTO command skip the header row and map data using column-name matching (MATCH_BY_COLUMN_NAME = CASE_INSENSITIVE) - handling different column orders gracefully while extra columns are ignored via ERROR_ON_COLUMN_COUNT_MISMATCH = FALSE.
Why the distractors fail:
- A - Creating a separate external table per file is operationally unscalable and defeats the goal of unified loading.
- B - Storing CSV data in a
VARIANTcolumn introduces unnecessary complexity; Snowflake is already purpose-built for structured CSV ingestion without needing semi-structured workarounds. - D - A view reshapes how you query data but does nothing to fix the underlying ingestion problem of mismatched columns during the load itself.
- E - Pre-processing adds an extra pipeline stage and operational burden; the correct answer solves the problem natively within Snowflake.
Memory tip: Think of option C as the "union table" strategy - like a SQL UNION ALL that needs a superset of all columns to accommodate every participant. If the table has every possible column and you skip the header row, Snowflake can match what it finds and NULL-fill what it doesn't, keeping the load simple and the pipeline single-stage.
Topics
Community Discussion
No community discussion yet for this question.