Re: [sqlalchemy] SQLAlchemy CORE: bindparam with postgresql on_conflict_do_update with a JSONB column

2020-09-15 Thread Massimiliano della Rovere
I removed all the tables from the DB and recreated them all (Settings among them) with alembic and everything worked. Thanks for your help, Mike! Il giorno mar 15 set 2020 alle ore 17:56 Mike Bayer < mike...@zzzcomputing.com> ha scritto: > here's one based on your samples of code, works fine on

Re: [sqlalchemy] SQLAlchemy CORE: bindparam with postgresql on_conflict_do_update with a JSONB column

2020-09-15 Thread Mike Bayer
here's one based on your samples of code, works fine on this end, you can use this to see what you are doing differently. from sqlalchemy import bindparam from sqlalchemy import Column from sqlalchemy import create_engine from sqlalchemy import MetaData from sqlalchemy import String from

Re: [sqlalchemy] SQLAlchemy CORE: bindparam with postgresql on_conflict_do_update with a JSONB column

2020-09-15 Thread Mike Bayer
this indicates a bindparam() object is being interpreted as a value somewhere but I can't reproduce that. can you provide an MCVE ? On Tue, Sep 15, 2020, at 11:33 AM, Massimiliano della Rovere wrote: > Yes, Mike, that solved the problem! I forgot to pass the column name. > > Now I get a

Re: [sqlalchemy] SQLAlchemy CORE: bindparam with postgresql on_conflict_do_update with a JSONB column

2020-09-15 Thread Massimiliano della Rovere
Yes, Mike, that solved the problem! I forgot to pass the column name. Now I get a different error: bindparam is not json-serializable. StatementError('(builtins.TypeError) Object of type BindParameter is not JSON serializable'), Is the JSONB column not supporting lazy/bindparam-compatible

Re: [sqlalchemy] SQLAlchemy CORE: bindparam with postgresql on_conflict_do_update with a JSONB column

2020-09-15 Thread Mike Bayer
the dictionary is with column names as keys: set_={"data": bindparam("timestamps")} hope this helps On Tue, Sep 15, 2020, at 10:55 AM, Massimiliano della Rovere wrote: > Greetings, > I am using SQLAlchemy==1.3.18. > > I have an SQLAlchemy "Settings" table with a "data" column defined as: >

[sqlalchemy] SQLAlchemy CORE: bindparam with postgresql on_conflict_do_update with a JSONB column

2020-09-15 Thread Massimiliano della Rovere
Greetings, I am using SQLAlchemy==1.3.18. I have an SQLAlchemy "Settings" table with a "data" column defined as: from sqlalchemy.dialects.postgresql import JSONB Settings = Table( "settings", self._metadata, # ... Column("data", JSONB, nullable=False)) and later in the code this

Re: [sqlalchemy] How to custom 'merge' behavior of a column type?

2020-09-15 Thread Mike Bayer
On Tue, Sep 15, 2020, at 12:02 AM, sonsshh wrote: > Hi Mike, > > My use case involves receiving a lot of data over the network, processing on > the model and persisting them. > Therefore, using the manual approach would be quite inefficient. session.merge() is not any more efficient than what