Re: [sqlalchemy] Is it possible to add another criterion to this backref?

2015-03-25 Thread Adrian
Is what I'm trying to be possible assuming I cannot add any code to the User model? In the future there might be plugins in my application which could contain favorites, but while plugins can add their own models, they are never allowed to directly modify a class in the application core. --

Re: [sqlalchemy] Is it possible to add another criterion to this backref?

2015-03-25 Thread Adrian
In case it's unclear what exactly I'm trying to do, here's the version with the relationship defined right in the User model that works fine. I'd like to do this exact same thing, but somehow define the relationship outside the User model. Preferably by using the normal declarative syntax to

Re: [sqlalchemy] Is it possible to add another criterion to this backref?

2015-03-25 Thread Michael Bayer
Im trying to avoid having to write a full example for you from scratch so if you could provide everything in one example, both models and where you want the relationships, with all the columns, we can work from there, thanks. Adrian adr...@planetcoding.net wrote: In case it's unclear what

Re[2]: [sqlalchemy] Is it possible to add another criterion to this backref?

2015-03-25 Thread Adrian
Sure, no problem with that. I'll add a small self-contained example for it tomorrow. - Adrian On 25.03.2015 14:21 Michael Bayer wrote: Im trying to avoid having to write a full example for you from scratch so if you could provide everything in one example, both models and where you want the

Re: [sqlalchemy] Re: Dynamically constructing joins

2015-03-25 Thread Greg Silverman
Ha! Ha! On my previous attempts, I had something similar to this, but instead, I had query = db.session.query(label('sid', distinct(a[1].c.patient_sid))) if (n 1): for table in join_tables[1:]: for criterion in join_criteria[1:]:

[sqlalchemy] Re: Dynamically constructing joins

2015-03-25 Thread Jonathan Vanasco
Yeah, there's no reason to touch eval -- and a lot of reasons not to. Security issues aside, when you make a mistake the error will be completely unintelligible. You can create joins dynamically very easily by just iteratively building up on it, and using getattr() if needed. If you're doing

[sqlalchemy] Re: Dynamically constructing joins

2015-03-25 Thread Horcle
eval() was definitely not doing what I expected. Thanks for the tip about getattr(), and thanks for helping get my head screwed on right! Greg-- On Wednesday, March 25, 2015 at 11:33:44 AM UTC-5, Jonathan Vanasco wrote: Yeah, there's no reason to touch eval -- and a lot of reasons not to.

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-03-25 Thread Richard Gerd Kuesters | Pollux
hell yeah! that's exactly what i was looking for :) is it in the 1.0.0b3 or upstream? best regards, richard. On 03/24/2015 08:49 PM, Michael Bayer wrote: are these two separate constraints? I just looked and it seems like they are distinct. I just added a fix to 1.0 because someone was