Re: [sqlalchemy] Re: Relationship to child with 2 foreginKey from same Parent column

2018-09-04 Thread Alireza Ayin Mehr
Thanks a lot This works, I cant remember why I was passing the User object as the argument How can I mark a post as the answer here? On Monday, September 3, 2018 at 1:29:10 PM UTC+4:30, Simon King wrote: > > Here's a version which I *think* does what you want. There are a > couple of things

Re: [sqlalchemy] Re: Relationship to child with 2 foreginKey from same Parent column

2018-09-03 Thread Simon King
Here's a version which I *think* does what you want. There are a couple of things that you might want to note. First, in your paste, Conversation.user1 and Conversation.user2 are integer columns, but you are assigning User objects to those properties. That's not the way SQLAlchemy works - you

Re: [sqlalchemy] Re: Relationship to child with 2 foreginKey from same Parent column

2018-09-02 Thread Alireza Ayin Mehr
Well, it seems weird this way, I only have one userId in my parent class which is the source class On Sunday, September 2, 2018 at 6:08:33 AM UTC+4:30, Seth P wrote: > > In relationship(), foreign_keys refers to the field in the source table, > not the destination. > -- SQLAlchemy - The

Re: [sqlalchemy] Re: Relationship to child with 2 foreginKey from same Parent column

2018-09-01 Thread Seth P
In relationship(), foreign_keys refers to the field in the source table, not the destination. -- 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. See

Re: [sqlalchemy] Re: Relationship to child with 2 foreginKey from same Parent column

2018-09-01 Thread Alireza Ayin Mehr
Using or_ function https://paste.ofcode.org/zd7aqqwR4V4rpYjfpmCHQg On Friday, August 24, 2018 at 2:26:21 AM UTC+4:30, Mike Bayer wrote: > > is there a stack trace (just the beginning and then a bit of the > repeating part, not the whole thing), there's no recursion inherent in > the SQLAlchemy

Re: [sqlalchemy] Re: Relationship to child with 2 foreginKey from same Parent column

2018-09-01 Thread Alireza Ayin Mehr
It's riding me crazy here is a MVCE https://paste.ofcode.org/7evqFGabM3Ls8qXiNnTGSy On Friday, August 24, 2018 at 2:26:21 AM UTC+4:30, Mike Bayer wrote: > > is there a stack trace (just the beginning and then a bit of the > repeating part, not the whole thing), there's no recursion inherent in

Re: [sqlalchemy] Re: Relationship to child with 2 foreginKey from same Parent column

2018-09-01 Thread Alireza Ayin Mehr
Stacktrace with codes => https://paste.ofcode.org/N4L9vHq6KqiupFRxBDTedZ Its riding me crazy On Friday, August 24, 2018 at 2:26:21 AM UTC+4:30, Mike Bayer wrote: > > is there a stack trace (just the beginning and then a bit of the > repeating part, not the whole thing), there's no recursion

Re: [sqlalchemy] Re: Relationship to child with 2 foreginKey from same Parent column

2018-08-23 Thread Mike Bayer
is there a stack trace (just the beginning and then a bit of the repeating part, not the whole thing), there's no recursion inherent in the SQLAlchemy part of this so something must be up with your model. an MCVE (see the link below) is always the best way to show what's happening. On Thu, Aug

[sqlalchemy] Re: Relationship to child with 2 foreginKey from same Parent column

2018-08-23 Thread Alireza Ayin Mehr
Well, I tried "or_()" before primaryjoin="or_(User.id == Conversation.user1, User.id == Conversation.user2)" It returns RecursionError :( On Thursday, August 23, 2018 at 9:00:58 PM UTC+4:30, Jonathan Vanasco wrote: > > I believe something like this should work. > > > conversations =