I think this goes slightly against the way SQLAlchemy wants to work.
In particular, SA's identity map means that if you queried for Things
where current_user=1, and then ran another query for Things where
current_user=2 in the same session, you would get the same instances
back, but the
Hi Simon,
I want to specify the "current user_id" with some kind of filter, so I
either get thing+like or thing (if no like is found).
The joinedload does what I need, but it still needs the filtering (so I
don't get all likes for a product, but only 1 filtered by user_id) ?
On Thu, Nov 10,
On Thu, Nov 10, 2016 at 9:32 AM, Dorian Hoxha wrote:
> So I have:
>
> class Thing():
> current_user_like = relationship(Like)
>
> class User():
> pass
>
> class Like():
> user_id = Column(primary_key=True)
> thing_id = Column(primary_key=True)
>
>
> Now I
So I have:
class Thing():
current_user_like = relationship(Like)
class User():
pass
class Like():
user_id = Column(primary_key=True)
thing_id = Column(primary_key=True)
Now I want, to do "session.query(Thing).all()" and also join the
"current_user_like" for each Thing, but