QuestionQ118

Ingest and Process Data

A Data Engineer is attempting to load the following CSV rows into a Snowflake table with this structure:

Question Image

Question Image

The engineer uses the following COPY INTO statement:

Question Image

However, the following error is returned:

Number of columns in file (6) does not match that of the corresponding table (3), use file format option error_on_column_count_mismatch=false to ignore this error File 'address.csv.gz', line 3, character 1 Row 1 starts at line 2, column "STGCUSTOMER"[6] If you would like to continue loading when an error is encountered, use other values such as 'SKIP_FILE' or 'CONTINUE' for the ON_ERROR option.

Which file format option should be used to fix the error and load all data successfully into the table?

Explanation

FIELD_OPTIONALLY_ENCLOSED_BY = '"' tells Snowflake to treat double-quoted values as a single CSV field. This preserves commas within quoted address values instead of parsing them as extra columns, so each record maps to the table’s three columns. Snowflake documents this option as the character used to enclose strings.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!