[sqlalchemy] duplicating a relationship ?

2019-11-05 Thread Jonathan Vanasco
I'm not sure if something broke during an upgrade, or if I just had bad tests and this was always an issue (I am assuming the latter!) I need to duplicate a relationship on a sqlalchemy ORM declarative object. I was hoping i could just do this (or at one point i could!) class Foo(DeclaredTable

[sqlalchemy] Re: Usage problem with CTEs and INSERTs

2019-11-05 Thread Lele Gaifax
"Mike Bayer" writes: > On Tue, Nov 5, 2019, at 4:08 AM, Lele Gaifax wrote: >> Hi all, >> >> I'm almost sure I'm missing the obvious, struggling to understand how to use >> a >> CTE with a PG "upsert" statement: I need to modify an existing (and working >> as >> expected) update statement based

Re: [sqlalchemy] 100% CPU and Memory utilization in DB query

2019-11-05 Thread Nitin Jain
Thanks a lot Mike . After using selectin loader (as per understanding in flask-sqlalchemy lazy=true/select is same as selectin ) instead of joined , previous problem related to high cpu / memory is resolved . I have one more query related to exclusion of nested relationships e.g. for joining t

Re: [sqlalchemy] Usage problem with CTEs and INSERTs

2019-11-05 Thread Mike Bayer
On Tue, Nov 5, 2019, at 4:08 AM, Lele Gaifax wrote: > Hi all, > > I'm almost sure I'm missing the obvious, struggling to understand how to use a > CTE with a PG "upsert" statement: I need to modify an existing (and working as > expected) update statement based on a CTE to an upsert, because now

[sqlalchemy] Usage problem with CTEs and INSERTs

2019-11-05 Thread Lele Gaifax
Hi all, I'm almost sure I'm missing the obvious, struggling to understand how to use a CTE with a PG "upsert" statement: I need to modify an existing (and working as expected) update statement based on a CTE to an upsert, because now the target information is kept in a different table. As said, w