q icon indicating copy to clipboard operation
q copied to clipboard

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

Open jgclark opened this issue 1 year ago • 4 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 ]

jgclark avatar Nov 10 '23 14:11 jgclark

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?

jgclark avatar Nov 10 '23 23:11 jgclark

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.

harelba avatar Nov 12 '23 07:11 harelba

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

jgclark avatar Nov 13 '23 16:11 jgclark

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.

jgclark avatar Jan 08 '24 23:01 jgclark