Re: [sqlalchemy] Compiling to Postgres VALUES clause with bindparam

2019-02-13 Thread Jonathan Vanasco
On Tuesday, February 12, 2019 at 6:14:44 PM UTC-5, Mike Bayer wrote: > > as you know I prefer making things possible to making things assumed > :) , because in the latter case, I have to keep attending to those > assumptions as they change.The whole "rewrite EXPANDING" part of > defaultdia

Re: [sqlalchemy] Compiling to Postgres VALUES clause with bindparam

2019-02-12 Thread Mike Bayer
On Tue, Feb 12, 2019 at 1:24 PM Jonathan Vanasco wrote: > > This looks very useful to other pg users. What about making this part of the > PostgreSQL dialect somehow? as you know I prefer making things possible to making things assumed :) , because in the latter case, I have to keep attending t

Re: [sqlalchemy] Compiling to Postgres VALUES clause with bindparam

2019-02-12 Thread Jonathan Vanasco
This looks very useful to other pg users. What about making this part of the PostgreSQL dialect somehow? -- 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.

Re: [sqlalchemy] Compiling to Postgres VALUES clause with bindparam

2019-02-11 Thread Mike Bayer
On Mon, Feb 11, 2019 at 3:37 PM Martin Stein wrote: > > So I have replaced the regex-based rewrite with the PGValuesParam approach > that we talked about. One issue with the regex-based rewrite was that in its > current form it breaks for parameter-lists > 10 elements, because the inner > sorte

Re: [sqlalchemy] Compiling to Postgres VALUES clause with bindparam

2019-02-11 Thread Martin Stein
So I have replaced the regex-based rewrite with the PGValuesParam approach that we talked about. One issue with the regex-based rewrite was that in its current form it breaks for parameter-lists > 10 elements, because the inner sorted(..) call does string-based sorting: 'IN \\(%\\(parent_ids_1\

Re: [sqlalchemy] Compiling to Postgres VALUES clause with bindparam

2019-02-08 Thread Mike Bayer
On Fri, Feb 8, 2019 at 10:05 AM Martin Stein wrote: > > Am Donnerstag, 7. Februar 2019 23:45:09 UTC+1 schrieb Mike Bayer: >> >> >> >> note the mentioned issue is closed. IN supports an inline parameter now: >> >> https://docs.sqlalchemy.org/en/rel_1_2/orm/extensions/baked.html#baked-in >> > > We

Re: [sqlalchemy] Compiling to Postgres VALUES clause with bindparam

2019-02-08 Thread Martin Stein
Am Donnerstag, 7. Februar 2019 23:45:09 UTC+1 schrieb Mike Bayer: > > > > note the mentioned issue is closed. IN supports an inline parameter now: > > https://docs.sqlalchemy.org/en/rel_1_2/orm/extensions/baked.html#baked-in > > We had started using the .op('IN') approach around v1.1 and I hadn'

Re: [sqlalchemy] Compiling to Postgres VALUES clause with bindparam

2019-02-07 Thread Mike Bayer
On Thu, Feb 7, 2019 at 3:59 PM Martin Stein wrote: > > We are using Postgres, the baked extension and have code along these lines: > > query = bakery( > lambda s: s.query(Item) >.filter(Item.parent_id.op('IN')(bindparam('parent_ids'))) > > > result = query(dbses

[sqlalchemy] Compiling to Postgres VALUES clause with bindparam

2019-02-07 Thread Martin Stein
We are using Postgres, the baked extension and have code along these lines: query = bakery( lambda s: s.query(Item) .filter(Item.parent_id.op('IN')(bindparam('parent_ids'))) result = query(dbsession).params(parent_ids=tuple(parent_ids)).all() The .op('IN') ap