The documentation here shows how to use the IN operator, but I could not find how to use the NOT IN operator.
If I put a not << , I get a syntax error.
If I put a not <FieldName> << , instead of WHERE (<FieldName> NOT IN (SELECT ... will be WHERE False .
Here is the result with sample documentation. The first is correct, the second and third are incorrect.
>>> Tweet.select().where(Tweet.user << a_users).sql() ('SELECT t1."id", t1."user_id", t1."message", t1."created_date", t1."is_published" FROM "tweet" AS t1 WHERE (t1."user_id" IN (SELECT t2."id" FROM "user" AS t2 WHERE (Lower(Substr(t2."username", ?, ?)) = ?)))', [1, 1, 'a']) >>> Tweet.select().where(not Tweet.user << a_users).sql() ('SELECT t1."id", t1."user_id", t1."message", t1."created_date", t1."is_published" FROM "tweet" AS t1 WHERE ?', [False]) >>> Tweet.select().where(Tweet.user not << a_users).sql() SyntaxError: invalid syntax
python sqlite peewee
stenci
source share