harelba / q

q - Run SQL directly on delimited files and multi-file sqlite databases

Home Page:http://harelba.github.io/q/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Always getting "query error: near "~": syntax error" error

jgclark opened this issue · comments

I'm upgrading to 3.1.6 from 2.1.x after brew's version of this stopped working. And I can't get it to run successfully at all even on a very basic file such as:

first,last,tag
Bob,Smith,leader
Fanny,Jones,helper
Joe,Clark,trustee

When I run any query, even the very simplest
q -H -d , "SELECT * from ./test-basic.csv"
I get the same error:
query error: near "~": syntax error
I can't find anything obviously related in the issues already.

I'm running on macOS 13.6.1 and the version string is

q version 3.1.6
Python: 3.8.11 (default, Jul 24 2021, 22:28:00) // [Clang 12.0.1 ]

I've now found a way to get the CSV into a SQLite file.
All my previous queries are now running OK, with only changing the filename they are working on.
Therefore the installation seems OK ... but there's still something funny odd going on with my CSV files?

Hi,

(Assuming I understand the issue properly, if not please write again and i'll help as much as i can).

Unfortunately, I haven't made q aware of the home folder ~ character, you would need to provide the full path and not use the ~ shortcut.

Thanks. However I'm not using ~ as part of filenames when calling q. See example above.

I had another look, and I think I've found where the ~ symbols are creeping in.
I'm running on macOS, and despite in the shall I'm only working in the current directory, it's doing full path expansion. And that starts '/Users/jonathan/Library/Mobile Documents/com~apple~CloudDocs/.
So, it's still not about the "home folder character", but it is about that character breaking q's processing in filepaths.