0

I have a Post model table like this:

class Base(Post):
  ...
  liked_users = Column(ARRAY(Integer))
  ...

I can not add new element to this column using this way:

post = db.query(DbPost).filter(DbPost.id == 1).first()

#print(post.liked_users) => [1,2]


post.liked_users.append(5)
db.commit()

Here I can not add 5 to the column liked_users. How can I solve this problem?

2
  • You might want to try the MutableList class from the mutable extension. Commented Jul 31, 2022 at 11:59
  • snakecharmerb, yes I found the answer. Thank you! Commented Jul 31, 2022 at 14:02

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.