sqlite选择查询,包括一个;价值观;在中,WHERE子句使用sqlite正确返回,但不使用python sqlite3

sqlite选择查询,包括一个;价值观;在中,WHERE子句使用sqlite正确返回,但不使用python sqlite3,python,sqlite,Python,Sqlite,我有下面的SQL查询,它从表“my_table”中选择列“item”和“feature”,其中一对列“item”和“other_feature”匹配一些值 select item, feature from my_table where (item, other_feature) in (VALUES ('item1', 'A'), ('item1', 'B')); 此查询在sqlite3命令行界面中按预期工作。但是,使用相同的数据库,在python中使用以下代码使用sqlite3模块时,

我有下面的SQL查询,它从表“my_table”中选择列“item”和“feature”,其中一对列“item”和“other_feature”匹配一些值

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

此查询在sqlite3命令行界面中按预期工作。但是,使用相同的数据库,在python中使用以下代码使用
sqlite3
模块时,我得到一个错误

import sqlite3
query = "select item, feature from my_table where (item, other_feature) in (VALUES ('item1', 'A'), ('item1', 'B'))"
conn = sqlite3.connect("data/my_database.db")
conn.execute(query)
我得到以下错误:

sqlite3.OperationalError: near ",": syntax error

为什么这个查询在python sqlite3模块中不能按预期工作?

尝试用
引用字符串:

您可能还需要检查sqlite版本是否正确

select sqlite_version();
或者用python

import sqlite3
sqlite3.sqlite_version

您的python发行版并不低于命令行界面的发行版,特别是如果它早于3.15.2。

运气不好,我在引用
时也会遇到同样的错误。事实上,对于
sqlite3.sqlite_版本
version 3.13.0,我有这个问题,它在3.16.2中工作正常。非常感谢。
import sqlite3
sqlite3.sqlite_version