I am looking for a way to update a DB column(attributes) which is of mediumtext type and contains some value like below.
{"id_real": "50", "id_virt": "40"}
Table structure is as below:
mysql> desc cust_cache;
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| id | varchar(250) | NO | PRI | NULL | |
| type | varchar(75) | NO | | NULL | |
| attributes | mediumtext | NO | | NULL | |
+------------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
Now I need to update this dict with some other extra key and value.
so new value will be as follows:
{"id_real": "50", "id_virt": "40", "purchase_status":"done", "payment":"done"}
I am trying to figure out the way for updating the field at single update query without reading a value and appending then updating it.
Expecting a way to do in python.
Any help is appreciable.