Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

COPY INTO statement is not generating file type as .csv – Snowflake, S3

I am copying data from Snowflake to S3 using COPY INTO statement.

This is the code:

copy into 's3://dev'
  from "TEST_DATABASE"."RAW_DATA"."TEMP_TABLE"
  credentials = (aws_key_id='***' aws_secret_key='***')
  OVERWRITE = TRUE
  file_format = (type=csv compression='none')
  single=true
  max_file_size=4900000000; 

Data gets copied but I don’t get a .csv extension.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I get data as the filename, not data.csv.

What am I doing wrong here?
Any advice appreciated.

>Solution :

There is a parameter called FILE_EXTENSION within the file format options. This should help you get the desired file extension added. You need to specify this parameter, because you are unloading your data into multiple files, not one single file.

Docs for FILE_EXTENSION: https://docs.snowflake.com/en/sql-reference/sql/copy-into-location.html#type-csv

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading