Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to include column names in the csv with a copy into statement in Snowflake?

For example:

COPY INTO @my_stage/my_test.csv 
FROM (select * from my_table) 
FILE_FORMAT = (TYPE = CSV) 
OVERWRITE=TRUE SINGLE=TRUE 

will result in a csv but does not include column headers. If it is not possible with a copy into statement, is there perhaps any non-obvious technique that might accomplish this?

Thanks in advance.

like image 763
David Morgan Avatar asked Mar 09 '16 19:03

David Morgan


1 Answers

Snowflake has added this feature. You can simply add an option HEADER=TRUE:

COPY INTO @my_stage/my_test.csv 
FROM (select * from my_table) 
FILE_FORMAT = (TYPE = CSV) 
OVERWRITE=TRUE SINGLE=TRUE HEADER=TRUE
like image 184
Jiaxing Liang Avatar answered Jan 02 '23 17:01

Jiaxing Liang