textql
textql copied to clipboard
Headers with column names containing spaces not supported
input.csv:
Column 1,Column 2
A,B
C,D
Query:
textql -header -sql 'select [Column 1]' input.csv
Expected result:
A
C
Actual result:
2017/05/23 15:21:00 no such column: Column 1
Quoting the column names does not help.
The same problem seems to exist for column names containing dots, like Column.1
I got this working if I quote the fields AND leave the FROM clause in the SQL statement.
EG:
textql -header -sql 'select [Column 1] from [input]' input.csv
I can confirm the workaround by @awildeep works for columns with dots too.
The workaround also works when working on stdin by selecting from the table named stdin
like this:
$ echo "Column 1,Column 2
A,B
C,D" | textql -header -sql 'select [Column 2] from stdin'
B
D
Backticks can also be used instead of square brackets.
I think this issue could be closed with some documentation surrounding these work-arounds.