dinedal / textql

Execute SQL against structured text like CSV or TSV
MIT License
9.05k stars 300 forks source link

file name can not be numberic only #58

Open swuecho opened 8 years ago

swuecho commented 8 years ago
➜   textql --header --sql "count(1) " 1234.csv  
2016/05/07 12:51:21 near "1234": syntax error

rename the 1234.csv to sample.csv works

dinedal commented 8 years ago

https://www.sqlite.org/lang_keywords.html

Try textql --header --sql "count(1) from [1234]" 1234.csv

And yes, I need to support this quoting in the SQL parser :)

swuecho commented 8 years ago

thanks. quote the table name works, although select can not be omitted.

➜  textql --header --sql "count(1) from [1234]" 1234.csv  
2016/05/07 12:59:45 near "count": syntax error
➜  textql --header --sql "select count(1) from [1234]" 1234.csv  
268486

BTW, great work! Thanks.

David-Guillot commented 7 years ago

Thanks @swuecho for reporting this issue, I didn't think of renaming the file ;)

@dinedal don't need to rush on this one, the workarounds work well ;)