Re: [sqlalchemy] Postgresql JSON object update.

2021-05-24 Thread Massimiliano della Rovere
Thanks! Il giorno lun 24 mag 2021 alle ore 17:49 Simon King ha scritto: > You can use the "op" method: > > > https://docs.sqlalchemy.org/en/14/core/sqlelement.html#sqlalchemy.sql.expression.Operators.op > > some_column.op("||")(other_column) > > Hope that helps, > > Simon > > On Mon, May 24,

Re: [sqlalchemy] Postgresql JSON object update.

2021-05-24 Thread Simon King
You can use the "op" method: https://docs.sqlalchemy.org/en/14/core/sqlelement.html#sqlalchemy.sql.expression.Operators.op some_column.op("||")(other_column) Hope that helps, Simon On Mon, May 24, 2021 at 4:12 PM Massimiliano della Rovere wrote: > > In postgresql the || operator is the only

[sqlalchemy] Postgresql JSON object update.

2021-05-24 Thread Massimiliano della Rovere
In postgresql the || operator is the only way (no, the concat() function doesn't work) to concat 2 JSONB dicts; note that this works only with JSONB and not JSON. Example: suppose column "t.c" contains '{"a": 1}'::jsonb SELECT t.c || jsonb_build_object('b', 2); gives {"a": 1, "b": 2}