1
votes

I am trying to load a csv file using the COPY INTO command. Let's say I have a field called Company Name. In my data file, a company name with a command "Hello, Inc." will fail to load.

I am using these options

on_error = 'skip_file' FILE_FORMAT = ( TYPE = CSV, RECORD_DELIMITER='\n' );

What other option do I use in the COPY INTO command so that the ',' in the data does not confuse Snowflake since the field delimiter is defaulted to be ','

2

2 Answers

1
votes

Use:

  file_format = (type = csv field_optionally_enclosed_by='"')

https://docs.snowflake.com/en/user-guide/getting-started-tutorial-copy-into.html

Default is 'none', so setting field_optionally_enclosed_by to " will fix this issue.

https://docs.snowflake.com/en/sql-reference/sql/create-file-format.html#type-csv

0
votes

file_format = (type = csv field_optionally_enclosed_by='"')