Re: [sqlalchemy] Batch-remove (UPDATE) keys in JSONB column

2021-01-25 Thread Mike Bayer
On Mon, Jan 25, 2021, at 4:29 PM, Anders Steinlein wrote: > Hi, > > In PostgreSQL, I have a JSONB column named custom with for instance this > data: {"firmanavn": "Eliksir", "value": 123}. I can do a query such as this > to remove the "firmanavn" key from the column: > > UPDATE contacts SET

[sqlalchemy] Batch-remove (UPDATE) keys in JSONB column

2021-01-25 Thread Anders Steinlein
Hi, In PostgreSQL, I have a JSONB column named custom with for instance this data: {"firmanavn": "Eliksir", "value": 123}. I can do a query such as this to remove the "firmanavn" key from the column: UPDATE contacts SET custom = custom - 'firmanavn' WHERE custom ? 'firmanavn'; I have not found