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.15k stars 419 forks source link

"query error: no such function: IIf" on Windows #257

Open TheFive opened 3 years ago

TheFive commented 3 years ago

I am developing on a mac, q version on mac:

q version 2.0.19
Python: 3.9.4 (default, Apr  5 2021, 01:50:46) // [Clang 12.0.0 (clang-1200.0.32.29)]

and delivering on windows, q version here:

q version 2.0.19
Python: 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]

My SQL are working well on mac, but on windows i get the following error

query error: no such function: IIf

Is it an installation problem ? (the windows version working with a lower python version ?)

Is there a quick fix? as an alternative i have to change 45 IIf ' s to CASE WHEN X THEN Y ELSE Z END, which sounds doable.

harelba commented 3 years ago

This is interesting. python itself is embedded inside q's packaging so the installation would be identical across platforms and won't require installing/polluting the system python.

I was under the impression that I'm fixing the minor python version as well as part of the packaging, but it seems that that's not the case.

This probably happens because of the sqlite version that's being installed as part of the sqlite-python module, which includes iif() only from a certain version.

I'm in the middle of a huge development for q which will be out soon. I'll take care of fixing this in the next release.

Sorry for the inconvenience in the mean time.

TheFive commented 3 years ago

thanks for feedback, i have choosen to realize my workaround, so i am fine now.

i have found in SQLLite documentation:

SQLite introduced the IIF() function since version 3.32.0.