Re: [sqlalchemy] Transforming the expression of an aliased relationship

2020-04-30 Thread Mike Bayer
only the ORM version of it! I'm glad it's useful because I was not sure if anyone actually uses that function anymore, but there you go. On Thu, Apr 30, 2020, at 10:46 AM, Marnix le Noble wrote: > This is exactly what I was looking for! That's amazing, thank you very much. > I wasn't aware

Re: [sqlalchemy] Transforming the expression of an aliased relationship

2020-04-30 Thread Marnix le Noble
This is exactly what I was looking for! That's amazing, thank you very much. I wasn't aware you could pass a relationship to the onclause parameter of the join() function which I am now seeing is actually in the docs. Cheers! -- SQLAlchemy - The Python SQL Toolkit and Object Relational

Re: [sqlalchemy] Transforming the expression of an aliased relationship

2020-04-30 Thread Mike Bayer
If you are able to use the relationship to generate the onclause, at some point you need to know both that you are using that relationship as part of your onclause, and that the target is going to be some target. That's when the decision as to be made and you can do it using the ORM join

[sqlalchemy] Join while filtering on M2M

2020-04-30 Thread Marat Sharafutdinov
from sqlalchemy import Column, ForeignKey, Integer, create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship, sessionmaker Base = declarative_base() class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True)

[sqlalchemy] Transforming the expression of an aliased relationship

2020-04-30 Thread Marnix le Noble
Hello, I have been banging my head against an issue for a couple weeks now and I was wondering if anyone was willing to help me out. I have tried looking in the SQLAlchemy documentation and previous topics but haven't found an answer as of yet. Imagine the following scenario: # Tables Base =