0

I have a csv file attributes.csv from which I want to retrieve all records to a new file attributes_withoutPIDate.csv excluding records for which the Name column has "PI Date" as the value.

Commanding csvsql in this manner

csvsql -d ',' -I --query 'select * where Name <> "PI Date" from attributes' attributes.csv > attributes_withoutPIDate.csv

yields an error

(sqlite3.OperationalError) near "from": syntax error
[SQL: select * where Name <> "PI Date" from attributes]
(Background on this error at: http://sqlalche.me/e/e3q8)

I suspect a syntactical error. Can someone advise how to fix it?

muru
  • 69,900
  • 13
  • 192
  • 292
ptrcao
  • 5,455
  • 11
  • 36
  • 44

1 Answers1

0
csvsql -d ',' -I --query 'select * from attributes where Name <> "PI Date"' attributes.csv > attributes_withoutPIDate.csv

I think I've figured it out:-

The from TABLE must precede WHERE clause.

When re-writing the query as such, it seems to work.

ptrcao
  • 5,455
  • 11
  • 36
  • 44