Re: [sqlalchemy] struggling with postgres json related query using sqlalchemy -- sqlalchemy bug or issue with query?

2017-05-04 Thread Darin Gordon
I'm working on another json query and thought I'd circle back around to see whether I'd have to continue using the original "as_row" recipe. Not sure whether Lukas was correct about sharing a similar issue as the one I originally raised. On Thursday, March 16, 2017 at 10:24:51 AM UTC-4,

[sqlalchemy] bulk update with inheritance : weird behavior

2017-05-04 Thread yoch . melka
Hi, I'm facing to a strange behavior with bulk update on inherited class. These two queries work differently : from sqlalchemy import Column, Integer, String, ForeignKey, create_engine from sqlalchemy.orm import relationship, Session from sqlalchemy.ext.declarative import declarative_base

Re: [sqlalchemy] bulk update with inheritance : weird behavior

2017-05-04 Thread mike bayer
On 05/04/2017 09:29 AM, yoch.me...@gmail.com wrote: Le jeudi 4 mai 2017 16:07:22 UTC+3, Mike Bayer a écrit : On 05/04/2017 08:41 AM, yoch@gmail.com wrote: > Hi, > > I'm facing to a strange behavior with bulk update on inherited class. > > Is this a bug

Re: [sqlalchemy] Re: Bulk Lazy Loader for relationships

2017-05-04 Thread mike bayer
On 05/04/2017 12:07 AM, David Chanin wrote: Interesting - so it will be possible in 1.2 to do more custom relationship loading in a "post load" hook? it will, however this hook is still local to the objects that are local to the results of that Query. Thanks for the feedback! That

Re: [sqlalchemy] bulk update with inheritance : weird behavior

2017-05-04 Thread mike bayer
On 05/04/2017 08:41 AM, yoch.me...@gmail.com wrote: Hi, I'm facing to a strange behavior with bulk update on inherited class. These two queries work differently : # raise : Unconsumed column names: name try:

Re: [sqlalchemy] bulk update with inheritance : weird behavior

2017-05-04 Thread yoch . melka
Le jeudi 4 mai 2017 16:07:22 UTC+3, Mike Bayer a écrit : > > > > On 05/04/2017 08:41 AM, yoch@gmail.com wrote: > > Hi, > > > > I'm facing to a strange behavior with bulk update on inherited class. > > > > Is this a bug ? > > it's not. > > >

Re: [sqlalchemy] struggling with postgres json related query using sqlalchemy -- sqlalchemy bug or issue with query?

2017-05-04 Thread mike bayer
there's a long term issue to get around to handling all of PG's syntaxes fully at https://bitbucket.org/zzzeek/sqlalchemy/issues/3566/figure-out-how-to-support-all-of-pgs. Current target is 1.3 because it will be a huge effort, and it may continue moving out milestones. On 05/04/2017

[sqlalchemy] Re: Custom secondary relation with composite primary keys

2017-05-04 Thread Alex Plugaru
Hi Mike, Thanks! I followed your advice and indeed it does work as expected. However I still get this warning: SAWarning: relationship 'User.roles' will copy column role.account_id to column roles_users.account_id, which conflicts with relationship(s): 'User.roles' (copies user.account_id to

[sqlalchemy] Re: Bulk Lazy Loader for relationships

2017-05-04 Thread Jonathan Vanasco
On Thursday, May 4, 2017 at 12:16:20 AM UTC-4, David Chanin wrote: > > How do objects get registered into the aggressive loader? Does it happen > automatically when they're initially loaded via query or cache? Ideally we > wanted to group items together when they're loaded and do bulk lazy

Re: [sqlalchemy] bulk update with inheritance : weird behavior

2017-05-04 Thread yoch . melka
Thank you Mike for this clear explanation ! Le jeudi 4 mai 2017 16:41:37 UTC+3, Mike Bayer a écrit : > > > > > > In my real use case, we have to update both parent and child columns, so > > I want to use the Children class. > > so SQLite won't support that (nor will Postgresql or most other

[sqlalchemy] Re: Custom secondary relation with composite primary keys

2017-05-04 Thread Alex Plugaru
It worked! Thanks a lot! On Friday, 28 April 2017 18:49:40 UTC-7, Alex Plugaru wrote: > > Hello, > > There are 3 tables: `*Account*`, `*Role*`, `*User*`. Both `*Role*` and ` > *User*` have a foreign key `*account_id*` that points to `*Account*`. > > A user can have multiple roles, hence the

Re: [sqlalchemy] Re: Custom secondary relation with composite primary keys

2017-05-04 Thread mike bayer
try setting all but one of the four column targets as "foreign" so that there isn't an overlapping "foreign" constraint: roles = relationship( Role, secondary=roles_users, primaryjoin=and_(id == foreign(roles_users.c.user_id), account_id ==