I've spent an hour trying to reproduce this bug and can't.   I'm hoping 
someone can suggest what might be going on so I can make this reproducable 
for a bug report

I have 2 classes:

    class Foo(Base):
        __tablename__ = 'foo'
        id = Column(Integer, primary_key=True)
        bar_id = Column(Integer, ForeignKey("bar.id"), nullable=True)

    class Bar(Base):
        __tablename__ = 'bar'
        id = Column(Integer, primary_key=True)
        is_x = Column(Boolean, nullable=True)

    # monkeypatched relationship
    Foo.bar = sqlalchemy.orm.relationship("Bar", 
primaryjoin=sqlalchemy.and_(Foo.bar_id == Bar.id, Bar.is_x.op("IS 
NOT")(True)))

The not-reproducable problem is the following:

If I pass in a `contains_eager` clause WITHOUT doing a join, I end up 
limited to all the Foo's with a Bar.

    
session.query(Foo).options(contains_eager('bar')).order_by(Foo.id.desc()).offset(0).limit(100).all()

However if I join, or do a joinedload, I correctly end up with all the Foos 
(their Bar status is irrelevant)

The generated SQL looks fine 00 it seems that there's some post-processing 
bit in sqlalchemy that is dropping this.

My production version has several dozen attributes and class functions. 
 Testing one-by-one isn't working well.

Does anyone have hints on a better way to troubleshoot this?

Also, shouldn't `contains_eager` raise some sort of error if you don't 
actually contain that object?







-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to