Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python peewee原始查询不适用于with语句_Python_Sql_Sqlite_Peewee - Fatal编程技术网

Python peewee原始查询不适用于with语句

Python peewee原始查询不适用于with语句,python,sql,sqlite,peewee,Python,Sql,Sqlite,Peewee,我有一个在SQLite Spy(一个查看SQLite数据库的工具)中工作的查询,但我无法在python中将peewee作为原始查询使用 (简化的)查询是 (简化的)python代码是: from peewee import * db = SqliteDatabase(":memory:") db.execute_sql("WITH tags(name) AS ( VALUES('foo'),('bar') ) SELECT * FROM tags") 我犯了一个错误 peewee.Opera

我有一个在SQLite Spy(一个查看SQLite数据库的工具)中工作的查询,但我无法在python中将peewee作为原始查询使用

(简化的)查询是

(简化的)python代码是:

from peewee import *

db = SqliteDatabase(":memory:")
db.execute_sql("WITH tags(name) AS ( VALUES('foo'),('bar') ) SELECT * FROM tags")
我犯了一个错误

peewee.OperationalError: near "WITH": syntax error
我还尝试了RawQuery函数或使用PlayHouse扩展中的SqliteExtDatabase


这个错误是我造成的还是peewee的问题?

CTE是从3.8.3版开始引入SQLite的

很可能您的Python使用的是不支持的早期版本 检查sqlite3.sqlite\u版本\u信息


哪一个Python版本?我正在使用Python 2.7这是我没有想到的。我的
sqlite3.sqlite\u version\u info
(3,6,21)
我现在安装了最新的APSW包,并通过playhouse扩展在peewee中使用它:
从playhouse导入APSW\u ext db=APSW\u ext.APSWDatabase(:内存:“)db.execute\u sql(“使用标记(名称)作为(值('foo'),('bar'))从标记中选择*)
谢谢您的帮助。它现在起作用了。
peewee.OperationalError: near "WITH": syntax error