P
P
Prizrak2562021-01-20 15:05:58
Python
Prizrak256, 2021-01-20 15:05:58

How to insert the value of a variable into the database using peewee?

In my script, I am getting a user variable which is a database field. It changes every time. After getting this variable, I need to insert the value into the database, into this field. I tried to do it as usual:

# Получение значения переменной user
record = Table.get(Table.user_id == id)
record.user = 15
record.save()

However, at the output I get an error related to the fact that the script is trying to find a field called "user". Is there a way to do this, or do I need to look for other ways?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question