Hi Mike,

I have having issues letting a subclass load a parent's relationship that 
configured lazy="joined".

Let's say Engineer is a subclass of Person, and Person stores "company_id" 
and has a relationship called "company" that is lazy="joined".

Although I don't have a minimal reproducible example now, but in my setup, 
let's say:
engineer = session.query(Engineer).get(1)  # emits 1 query
engineer.company  # emits another query

I suspect that the subclass does not respect parent class' relationship 
lazy/eager loading options.

Also I bump into this issue when identity map remembers the id's 
polymorphic type. Then when I query on the base class, it emits the the 
subclass query and does not load the parent class' relationship with eager 
load options, which is the problem I mentioned.
engineer = session.query(Engineer).get(1)
session.commit()
person = session.query(Person).get(1)  # emits 1 query
person.company  # emits another query



Is this by design? If so, is there any way to make it respect parent class' 
relationship "lazy" option?

I am not 100% certain this is reproducible in a simple example. There may 
be problems in my setup that would cause this. Please let me know if this 
is the case.

Thanks in advance.

-- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/7960faaf-50a6-4edf-b35a-4b7eda89f7d0%40googlegroups.com.

Reply via email to