nerdexam
Snowflake

SOL-C01 · Question #192

Consider the following Snowflake SQL code snippet that attempts to load data from a CSV file into a table. Assume the file format 'MY CSV FORMAT' is correctly defined with appropriate delimiters and…

The correct answer is B. The error is related to an integrity constraint violation (e.g., a unique key violation), and = C. The file 'data.csv' is not present in the stage @MY_STAGE, and Snowflake cannot find the file to D. The user executing the COPY INTO command does not have the 'USAGE' privilege on the stage. Options B, C and D are correct. ERROR = 'CONTINUE' primarily handles file-level errors (like a corrupted file that can't be opened) and certain row-level errors (like incorrect number of columns). It does not handle integrity constraint violations; these will always cause the…

Data Loading and Unloading

Question

Consider the following Snowflake SQL code snippet that attempts to load data from a CSV file into a table. Assume the file format 'MY CSV FORMAT' is correctly defined with appropriate delimiters and skip header settings. Despite setting 'ON ERROR = 'CONTINUE", the COPY INTO operation fails and throws an error. Which of the following scenarios could explain this behavior?

Options

  • AThe error is a parsing error related to data type mismatch, and 'ON ERROR = 'CONTINUE" only
  • BThe error is related to an integrity constraint violation (e.g., a unique key violation), and =
  • CThe file 'data.csv' is not present in the stage @MY_STAGE, and Snowflake cannot find the file to
  • DThe user executing the COPY INTO command does not have the 'USAGE' privilege on the stage
  • E`ON_ERROR = 'CONTINUE" will always ensure a full load of the file and its impossible to find out

How the community answered

(43 responses)
  • A
    7% (3)
  • B
    79% (34)
  • E
    14% (6)

Explanation

Options B, C and D are correct. ERROR = 'CONTINUE'primarily handles file-level errors (like a corrupted file that can't be opened) and certain row-level errors (like incorrect number of columns). It does not handle integrity constraint violations; these will always cause the COPY INTO to fail, even withON ERROR = 'CONTINUE". If the file is not present (Option C) or the user lacks the USAGE privilege (Option D), the COPY INTO will fail before it even attempts to parse the data, and 'ON_ERROR will not apply because Snowflake cannot even access the file. Option A is incorrect as its not just parse level error, it may happen due to data validation contraints also. Option E is incorrect because 'ON_ERROR = 'CONTINUE'` will not ensure that the file is loaded no matter what, some issues will occur causing the COPY INTO to fail.

Topics

#COPY INTO#Error Handling#Data Loading#Stages

Community Discussion

No community discussion yet for this question.

Full SOL-C01 Practice