SOL-C01 · Question #168
You are tasked with loading data from a set of CSV files located in an Amazon S3 bucket into a Snowflake table named 'CUSTOMER DATA'. The files have headers, but some files might have inconsistent col
The correct answer is A. Use along with 'ON_ERROR = CONTINUE in the COPY INTO statement. Define a file format. Option A is correct because it combines the two critical features needed for this scenario: MATCH_BY_COLUMN_NAME (implied by the option's context) handles the inconsistent column ordering by using CSV header names to map columns to the table schema automatically, while ON_ERROR =
Question
You are tasked with loading data from a set of CSV files located in an Amazon S3 bucket into a Snowflake table named 'CUSTOMER DATA'. The files have headers, but some files might have inconsistent column order compared to the table schema. The table 'CUSTOMER DATA' is already created with the correct schema. Which of the following COPY INTO command options is BEST suited to handle this situation efficiently, minimizing manual intervention and ensuring all relevant data is loaded?
Options
- AUse along with 'ON_ERROR = CONTINUE in the COPY INTO statement. Define a file format
- BUse a simple 'COPY INTO' statement without any specific options and rely on Snowflake's
- CCreate a view on top of the staged data using 'SELECT statements that explicitly map columns by
- DUse 'ORDER BY clause in the 'COPY INTO' statement to explicitly define the order of columns
- EDefine a file format object with `SKIP_HEADER = 1' and -- (if applicable). Use 'MATCH BY
How the community answered
(28 responses)- A75% (21)
- B7% (2)
- C4% (1)
- D14% (4)
Explanation
Option A is correct because it combines the two critical features needed for this scenario: MATCH_BY_COLUMN_NAME (implied by the option's context) handles the inconsistent column ordering by using CSV header names to map columns to the table schema automatically, while ON_ERROR = CONTINUE ensures the load job proceeds even if individual rows or files have issues - together minimizing manual intervention and maximizing data throughput.
Why the distractors are wrong:
- B - A plain
COPY INTOwithout options assumes positional column matching; inconsistent column order will silently load data into wrong columns or error out. - C - Creating a SELECT-based view with explicit column mapping works but requires manual mapping for every schema variation, defeating the goal of minimizing intervention.
- D -
ORDER BYis not a valid clause inCOPY INTO; it belongs to query syntax, not data loading commands. - E - While
SKIP_HEADER = 1andMATCH_BY_COLUMN_NAMEare individually correct tools, this option omits theON_ERROR = CONTINUEsafety net needed to ensure all relevant data loads despite inconsistent files.
Memory tip: Think "Name it, Don't Order it, Don't Stop it" - use MATCH_BY_COLUMN_NAME so Snowflake matches by name not position, and ON_ERROR = CONTINUE so it doesn't stop on bad rows. Any option that relies on column position or manual mapping is wrong for variable-order CSVs.
Topics
Community Discussion
No community discussion yet for this question.