0
votes

Trying to load CSV data into Snowflake Table using COPY INTO SELECT FROM STAGE.

Target table have 1 extra column to capture load date time so the COPY STATEMENT is written as,

COPY INTO SF_TABLE FROM (SELECT $1,$2,$3,$4,CURRENT_TIMESTAMP(0) FROM STAGE) FILE_FORMAT='TEST'

$1-$4 is derived from the file columns runtime and select string is generated.

Now lets say my file got one column added and now the string is $1-$5. Will Snowflake be able to still load the existing columns using the earlier COPY Statement. Does MATCH_BY_COLUMN work in this case?

1

1 Answers

0
votes

As long as the new column is added at the end of the file (so it is $5 rather than $3, for example), and your defined file format still works with this additional column, then your COPY statement will continue to work.