Bug 6767 - Add a 'HEADER' option to export data using COPY with column names
Summary: Add a 'HEADER' option to export data using COPY with column names
Status: NEW
Alias: None
Product: SQL
Classification: Unclassified
Component: all (show other bugs)
Version: 11.33.11 (Apr2019-SP1)
Hardware: All All
: Normal enhancement
Assignee: SQL devs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-03 15:22 CEST by Fabio
Modified: 2019-10-03 17:16 CEST (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio 2019-10-03 15:22:07 CEST
User-Agent:       Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
Build Identifier: 

It would be really useful if MonetDB could have the ability to export a CSV file with column headers in the first line, as this kind of export/import operations is one of the most basic type of operations in data analysis.

Reproducible: Always

Steps to Reproduce:
COPY mytable 
INTO '/home/myfile.csv' 
USING DELIMITERS '|', '\n', '"' NULL AS '' HEADER;
Actual Results:  
None, as HEADER is not implemented

Expected Results:  
A delimited file with column headers that could be imported in some statistical application for data analysis
Comment 1 Sjoerd Mullender cwiconfidential 2019-10-03 17:15:48 CEST
There is something like this if you use mclient to export the data.
mclient -fcsv+, -d$database -s'select * from mytable' > myfile.csv

See the mclient manual [1].

[1] https://www.monetdb.org/Documentation/mclient-man-page
Comment 2 Sjoerd Mullender cwiconfidential 2019-10-03 17:16:48 CEST
I forgot to mention, you can use --null= to get the equivalent of NULL AS ''.