Those aren't easy cases to debug.  Isolating the behavior into a small test
is the best first step, failing that you'd at least have echo set to debug
, and you can watch the rows cone in.   If it were me I'd then be pdb'ing,
but I realize that's because I know the eagerload mechanics pretty well.

On Dec 15, 2016 9:39 PM, "Jonathan Vanasco" <[email protected]> wrote:

> I've got an edge-case that I can't reliably reproduce yet, and it's
> driving me crazy.
>
> I have a table/view that is used for an analytics report.   It just
> references 2 objects from a given table, along with a count.
>
> class Report(Base):
>     __tablename__ = 'report'
>     id = Column(Integer, primary_key=True)
>     object_a__id = Column(Integer, ForeignKey("object_a.id"))
>     object_a2__id = Column(Integer, ForeignKey("object_a.id"))
>     counted = Column(Integer, default=0)
>     object_a = relationship("ObjectA", primaryjoin="Report.object_a__
> id==ObjectA.id")
>     object_a2 = relationship("ObjectA", primaryjoin="Report.object_a2_
> _id==ObjectA.id")
>
>
> In certain circumstances (which I can't figure out), `object_a` is
> `None`, even though it exists in the database (and sometimes in the
> identity map, in an earlier row; or appears as object_a2).
>
>
>
> --
> 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 http://stackoverflow.com/help/mcve for a full
> description.
> ---
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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  http://stackoverflow.com/help/mcve for a full description.
--- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to