0
0
Snowflakecloud~10 mins

Handling load errors in Snowflake - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Handling load errors
Start Load Data
Attempt Data Load
Error Occurs?
NoLoad Success
Yes
Capture Error Details
Log or Store Errors
Decide: Retry or Skip
Retry Load
Load Success
Skip Error Rows
End Load Process
This flow shows how Snowflake handles data load errors by detecting errors, capturing details, logging them, and deciding whether to retry or skip problematic rows.
Execution Sample
Snowflake
COPY INTO my_table
FROM @my_stage/file.csv
ON_ERROR = 'CONTINUE';
This command loads data from a staged file into a table, continuing the load even if some rows cause errors.
Process Table
StepActionError DetectedError Details CapturedRows LoadedRows Skipped
1Start data loadNoN/A00
2Load row 1NoN/A10
3Load row 2YesInvalid date format11
4Load row 3NoN/A21
5Load row 4YesNull value in NOT NULL column22
6Load row 5NoN/A32
7End load processN/AN/A32
💡 All rows processed; load ended with 3 rows loaded and 2 rows skipped due to errors.
Status Tracker
VariableStartAfter Step 2After Step 3After Step 4After Step 5After Step 6Final
Rows Loaded0112233
Rows Skipped0011222
Error Details[][]["Invalid date format"]["Invalid date format"]["Invalid date format", "Null value in NOT NULL column"]["Invalid date format", "Null value in NOT NULL column"]["Invalid date format", "Null value in NOT NULL column"]
Key Moments - 3 Insights
Why does the load continue even after errors occur?
Because the ON_ERROR='CONTINUE' option tells Snowflake to skip error rows and keep loading the rest, as shown in steps 3 and 5 where errors are detected but loading proceeds.
How are error details tracked during the load?
Error details are captured and stored in a list each time an error occurs, as seen in the Error Details variable in steps 3 and 5 in the execution_table.
What happens to rows that cause errors during loading?
Rows with errors are skipped and not loaded into the table, increasing the Rows Skipped count, as shown in steps 3 and 5.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, how many rows were successfully loaded after step 4?
A2
B3
C1
D4
💡 Hint
Check the 'Rows Loaded' column at step 4 in the execution_table.
At which step does the first error occur during the load?
AStep 2
BStep 3
CStep 4
DStep 5
💡 Hint
Look for the first 'Yes' in the 'Error Detected' column in the execution_table.
If ON_ERROR was set to 'ABORT_STATEMENT', how would the execution_table change?
ALoad would stop at first error, fewer rows loaded
BAll rows would load regardless of errors
CErrors would be ignored and logged but load continues
DRows with errors would be retried automatically
💡 Hint
Consider how 'CONTINUE' allows skipping errors; 'ABORT_STATEMENT' stops on error.
Concept Snapshot
Snowflake load errors are handled by options like ON_ERROR.
ON_ERROR='CONTINUE' skips bad rows and logs errors.
Errors are captured during load and rows skipped.
Load continues until all rows processed or aborted.
Use error handling to keep data load smooth and controlled.
Full Transcript
This visual execution shows how Snowflake handles load errors during data import. The process starts by attempting to load each row. When an error occurs, such as invalid data format or null in a required column, Snowflake captures the error details and skips the problematic row if ON_ERROR='CONTINUE' is set. The load continues with the next rows, accumulating counts of loaded and skipped rows. This approach allows partial data loading without stopping the entire process. The execution table tracks each step, showing when errors happen, how many rows load successfully, and how many are skipped. Variables like Rows Loaded, Rows Skipped, and Error Details update after each step. Key moments clarify why loading continues despite errors and how errors are tracked. The quiz tests understanding of when errors occur, how many rows load, and the effect of different ON_ERROR settings. This helps beginners see step-by-step how Snowflake manages load errors to keep data pipelines running smoothly.