SQLP to support empty fields #2490
-
As part of my recent project, I had to add 73 fields to a table, some of which have an underscore Using When I try something like So Since I would like to push the envelope on this I'd love to see this done within |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
If I understand your problem correctly, you have a CSV with 73 fields, with special characters and you want to return an SSV. Also, I believe empty fields are not valid SQL. Have you tried something like this pipeline?
|
Beta Was this translation helpful? Give feedback.
-
Apologies for confusing Actually I generate in earlier steps a table with 13 columns (fqdn and ns1 to ns12) which are comma separated. To this I have to add 69 (sorry for the miscalc, but the principle applies) columns of specified names, in a particular order. SELECT '' as a, '' AS b, fqdn, '' AS c, ns1, ns2 ,
...,
ns12, '' as d,
... ,
'' AS lastcolumn FROM data; in other words I want to In Unfortunately COPY(
SELECT '' as a, '' AS b_1, fqdn, '' AS c*, ns1, ns2 ,
...,
ns12, '' as d,
...,
'' AS lastcolumn FROM data
) to '/dev/stdout' (HEADER, DELIMITER ','); bombs, escaping doesn't help, so I have to use column names without these offending characters and then pipe it into something like HEADERS="first,second_,fqdn,c*,ns1,ns2,...,lastcolumn`
duckdb ... | qsv rename "$HEADERS" | qsv fmt -d ';' |
Beta Was this translation helpful? Give feedback.
@ondohotola , have you tried using
null as
instead of'' as
?BTW, converted the issue to a discussion so other folks with similar questions can find it...