Reputation: 47
I am trying to load csv file to snowflake which has the below data. But i am getting "end of record reached while expected to parse column" error. customer_key,product,customer_id,first_name,last_name,res_version,updated_at 1234,desk,10977,Harry,Western \,1,20-04-1994
I have put the code i tried below. Can someone help me solve this error.
cs.execute("PUT file://"+cleaned_path+"file_name.csv @%file_name")
cs.execute("""copy into file_namefile_format=(type=csv skip_header=1 FIELD_OPTIONALLY_ENCLOSED_BY = '"' EMPTY_FIELD_AS_NULL = TRUE)""")
Upvotes: 3
Views: 5233
Reputation: 158
Try one of these options:
ESCAPE_UNENCLOSED_FIELD = None
or something like this: COPY INTO table FROM ( select replace(t.$1,'\') from @table/test.txt.gz t) FILE_FORMAT=(TYPE=CSV FIELD_DELIMITER='\x01')
Upvotes: 5