I got orm object like this:
class Fruit(ModelBase):
__tablename__ = "fruits"
id = Column(BigInteger, nullable=False)
name = Column(Unicode)
price = Column(Integer)
and my table looks like this:
+----+--------+-------+
| id | name | price |
+----+--------+-------+
| 1 | apple | 100 |
| 2 | carrot | 200 |
| 3 | orange | 300 |
+----+--------+-------+
I want to update my orm object with data so my table would look like this:
+----+--------+-------+
| id | name | price |
+----+--------+-------+
| 1 | apple | 500 |
| 2 | carrot | 200 |
| 3 | orange | 600 |
+----+--------+-------+
Fruits
updated_data = [{"id": 1, "name": "apple", "price": 500}, {"id": 3, "name": "orange", "price": 600}]
How can I update my orm object Fruits having data from updated_data list?
I tried with
update(Fruit).where(Fruit.id == updated_data.id).values(updated_data)
but it doesn't work.