I'm using Flask-SQLAlchemy version 2.1 which installs sqlalchemy version 1.x.
My below code which first fetch an array of resultset and then loop over to modify an existing attribute used to work but now it does not.
question_topic = Question.query.join(Topic).join(User,User.id==Question.user_id).add_columns(User.email,Question.question, Question.date, Topic.topic_name, Question.id, Topic.question_id)\
.filter(Question.id == Topic.question_id).all()
for q_t in question_topic:
q_t.topic_name = q_t.topic_name + "some text..."
I get following error: attributeError: can't set attribute with 'topic_name'
I had the same error ("AttributeError: can't set attribute" error) on a new column. It was due to a @property that I had previously added and that had the same name than the column.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With