zed icon indicating copy to clipboard operation
zed copied to clipboard

schema argument for CSV reader

Open mccanne opened this issue 3 years ago • 1 comments

The CSV reader should take a schema argument to handle cases where there is no CSV header in the file but simply a sequence of comma-separated values. The schema would simply be a ZSON record type passed as a command-line arg to on the input flags group.

For example,

echo '1,"foo"' | zq  -i csv -schema '{a:int64,b:string}' -

would produce

{a:1,b:"foo"}

Thanks to Jason Deyalsingh for suggesting this on Brim slack.

mccanne avatar Mar 25 '22 18:03 mccanne

#3710 looks like a duplicate of this issue, so I'm closing that one. But here's a comment from there that may be relevant when we take this up:

sqlite has a similar config with its CSV virtual table feature

philrz avatar Sep 02 '22 17:09 philrz