Hi , I have below jsonb blob which i wanted to update subset value.
{
"preference": {
"android": {
"software_update": "true",
"system_maintenance": "true"
},
"ios": {
"software_update": "true",
"system_maintenance": "true"
}
}
}
how to i update only "android" blob which is inside "preference"
can someone help here with sqlalchemy query?
the following snippet doesnt worked for me
app_name = 'android'
pref = {"software_update": "false", "system_maintenance": "false"}
qu = session.query(SystemSubscription).filter(SystemSubscription.username ==
'[email protected]').update(
{SystemSubscription.preference: cast(
cast(SystemSubscription.preference[app_name],
JSONB).concat(func.jsonb_build_object(app_name, json.dumps(pref))),
JSON)}, synchronize_session="fetch")
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sqlalchemy/53f0dc96-7884-42b1-890b-26e20193708a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.