harelba / q

q - Run SQL directly on delimited files and multi-file sqlite databases
http://harelba.github.io/q/
GNU General Public License v3.0
10.19k stars 421 forks source link

Delimiter must be one character only #249

Closed KevinColemanInc closed 3 years ago

KevinColemanInc commented 3 years ago

q rejects the delimiter '≫'

q -H -d '≫' "select count(*), type  from all.csv group by type"
Delimiter must be one character only

version:

q --version
q version 1.7.4
Copyright (C) 2012-2017 Harel Ben-Attia (harelba@gmail.com, @harelba on twitter)
http://harelba.github.io/q/

Python 2.7.17

harelba commented 3 years ago

Hi,

This is related to the fact that you're using python 2 and not 3, combined with the fact that you're using an older version of q (1.7.4). The reason is related to how python 2 (mis)handles encodings.

$ cat all.csv
a≫b≫c
1≫2≫3
4≫5≫6

$ q --version
q version 2.0.19
Python: 3.8.5 (default, Jul 21 2020, 10:48:26) // [Clang 11.0.3 (clang-1103.0.32.62)]
Copyright (C) 2012-2020 Harel Ben-Attia (harelba@gmail.com, @harelba on twitter)
http://harelba.github.io/q/
$ q -H -d '≫' "select *  from all.csv" -D ,
1,2,3
4,5,6
$ 

Starting from version 2.0.0 of q, the executable is standalone (even python itself is not needed) and inherently contains python 3 as part of it.

Please install the latest version and try. If there's still an issue please ping me, I'd be glad to help.

Harel