Skip to content Skip to sidebar Skip to footer

Sqlite Select Query Including A "VALUES" In The WHERE Clause Returns Correctly With Sqlite But Not With Python Sqlite3

I have the following SQL query that selects the column 'item' and 'feature' from the table 'my_table' where the pair of columns 'item' and 'other_feature' match some pair of values

Solution 1:

Try quoting your strings with ":

query = 'select item, feature from my_table where (item, other_feature) in (VALUES ("item1", "A"), ("item1", "B"))'

You also might want to check that the sqlite version

select sqlite_version();

or in python

import sqlite3
sqlite3.sqlite_version

of you python distribution is not lower than that of your command line interface, and in particular if it is earlier than 3.15.2.


Post a Comment for "Sqlite Select Query Including A "VALUES" In The WHERE Clause Returns Correctly With Sqlite But Not With Python Sqlite3"