mercredi 9 décembre 2015

peewee raw query does not work with WITH statement

I have query which works in SQLite Spy (a tool for viewing SQLite Databases) but I can't get the query to work in python with peewee as a raw query.

The (simplified) query is

WITH tags(name) AS ( VALUES('test1'),('test') ) SELECT * FROM tags

The (simplified) python code is:

from peewee import *

db = SqliteDatabase(":memory:")
db.execute_sql("WITH check_tags(name) AS ( VALUES('huddle'),('test') ) SELECT * FROM check_tags")

I get an error

peewee.OperationalError: near "WITH": syntax error

I also tried the RawQuery function or using SqliteExtDatabase from the PlayHouse extension.

Is this error caused by me or is it a problem of peewee?

Aucun commentaire:

Enregistrer un commentaire