asit_dhal
asit_dhal

Reputation: 1269

modify Readonly Tuple in flask-alchemy

I have the following scenario

partner = query().filter(Partners.id == partner_id).first()
if partner != None:
    partner.config = json.loads(partner.config, cls=DateTimeDecoder)

I want to modify the the response of sqlalchemy query result. But as it's a Readonly tuple, its not allowing me to do so.

Can somebody tell me how to do this ?

Basically after the processing if I want to get partner.config, I should get the proper value.

Upvotes: 1

Views: 63

Answers (1)

Neel
Neel

Reputation: 21243

You have to convert it into list and then you can change data in list.

ResultSet return from query will be immutable so you cant change directly same object.

Upvotes: 2

Related Questions