Mukul Kumar
Mukul Kumar

Reputation: 724

unload Snowflake data to s3 without the extension/file_format

How can I unload snowflake data to s3 without using any file format?

For unloading the data into a specific extension we use file format in snowflake.

E.g. code

  copy into 's3://mybucket/unload/'
  from mytable
  storage_integration = myint
  file_format = (format_name = my_csv_format);

But what I want is to store data without any extension.

Upvotes: 1

Views: 1369

Answers (2)

Mukul Kumar
Mukul Kumar

Reputation: 724

SINGLE is what I was looking for. It is one of parameters we can use with COPY command which creates the file without extension.

Code:

copy into 's3://mybucket/unload/'
from mytable
storage_integration = myint
file_format = (format_name = my_csv_format)
SINGLE = TRUE;

Go through note of below link for better understanding:

https://docs.snowflake.com/en/sql-reference/sql/create-file-format.html#:~:text=comma%20(%2C)-,FILE_EXTENSION,-%3D%20%27string%27%20%7C%20NONE

Upvotes: 1

Marcel
Marcel

Reputation: 2612

You can add the parameter FILE_EXTENSION = NONE to your file format. With this parameter Snowflake is not adding a file extension based on your file format (in this case .csv), but is using the passed extension (NONE or any other).

copy into 's3://mybucket/unload/'
from mytable
storage_integration = myint
file_format = (format_name = my_csv_format file_extension = NONE);

https://docs.snowflake.com/en/sql-reference/sql/copy-into-location.html

Upvotes: 0

Related Questions