mithrandie / csvq

SQL-like query language for csv
https://mithrandie.github.io/csvq
MIT License
1.49k stars 65 forks source link

Support columns with dot in the name #97

Open philippgille opened 1 year ago

philippgille commented 1 year ago

Hi, thanks for maintaining the open source csvq tool!

I just tried it on a CSV file, but it didn't work as I expected, seemingly because of a dot in the column name.

OS: macOS csvq version: v1.17.11, installed via Go

  1. ✅ I run csvq 'select * from `/path/to/file.csv`'. It prints the table, with foo.bar as one column name
  2. ❌ I run csvq 'select foo.bar from `/path/to/file.csv`'. It prints [L:1 C:17] field foo.bar does not exist
  3. ❌ I run csvq 'select "foo.bar" from `/path/to/file.csv`'. It prints a long table (matching number of rows of my CSV) with just foo.bar rows, so not the actual value

It's not clear to me how to select a column that contains a dot in the name.

kpym commented 1 year ago

check

csvq 'select `foo.bar` from `/path/to/file.csv`' 

(column name quoted with back ticks)

P.S. foo.bar (non quoted) means "column bar in the table named foo"