Skip to content
Advertisement

Snowflake to S3 with Header

Does anyone know of a way to export your data from Snowflake to an S3 file with a header?

For example, I have this table:

I want to export this data to a file that looks like this:

… but I don’t see an option in the Snowflake documentation to do so.

I tried a simple UNION ALL with the names of the columns unioned to the data, but that places my header record randomly in the file.

Any and all help would be appreciated!

Advertisement

Answer

You can use the copy option HEADER = TRUE | FALSE in your Copy_into Location statement.

Reference: https://docs.snowflake.com/en/sql-reference/sql/copy-into-location.html#optional-parameters

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement