Closed fruitoiz closed 4 months ago
Nonsense bro did you even test this?
from peewee import *
db = SqliteDatabase(':memory:')
class User(db.Model):
user_id = AutoField()
balance = IntegerField()
db.create_tables([User])
for i in range(10):
User.create(balance=i)
User.update(balance=1).where(User.user_id.in_([1, 2])).execute()
User.update(balance=1).where(User.user_id << [3, 4]).execute()
for u in User.select().order_by(User.user_id):
print(u.user_id, u.balance)
Output is correct:
1 1
2 1
3 1
4 1
5 4
6 5
7 6
8 7
9 8
10 9
Exactly, this happened because I did not indicate what to update.
User.update(User.balance+1).where(User.user_id << [1, 2])
Forgot about balance=
The first and second options don't work. The error is the same.
Tested for:
3.17.5
and3.15.4
Python:3.12