Answer the question
In order to leave comments, you need to log in
Why doesn't peewee save changes?
Peewee, for some unknown reason, stopped updating records in the database
user = User.get(User.telegram_id == telegram_id)
user.state = json.dumps({
'action': 'create',
'step': 'name',
'type': 'Categories',
'value': None
})
user.save()
user = User.get(User.telegram_id == telegram_id)
user.state = json.dumps({
'action': 'create',
'step': 'name',
'type': 'Categories',
'value': None
})
user.save(force_insert=True)
peewee.IntegrityError: (1062, "Duplicate entry '1' for key 'PRIMARY'")
state = json.dumps({
'action': 'create',
'step': 'name',
'type': 'Categories',
'value': None
})
query = User.update({User.state: state}).where(User.telegram_id == telegram_id)
query.execute()
Answer the question
In order to leave comments, you need to log in
Flex (for better and easier browser support) + box-shadow (to keep the box size small; can be replaced with a pseudo-element):
The most interesting thing is that it worked before and suddenly stopped working.
I noticed this after I decided to change the program for viewing SQLite files.
After opening the database in another program, when executing the code, I received an error that the database was already in use.
Changed DBMS to MySQL. Now everything works, but the existing records in the database are not updated.
New ones are created and old ones are NOT overwritten.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question