Thanks Mike. I've attached a script that shows the difference in case that
helps.
--
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.
from sqlalchemy import Column, ForeignKey, Integer
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import joinedload, relationship
Base = declarative_base()
class Book(Base):
__tablename__ = 'book'
id = Column(Integer, primary_key=True)
pages = relationship('Page', backref='book')
class Font(Base):
__tablename__ = 'font'
id = Column(Integer, primary_key=True)
class Layout(Base):
__tablename__ = 'layout'
id = Column(Integer, primary_key=True)
class Page(Base):
__tablename__ = 'page'
id = Column(Integer, primary_key=True)
book_id = Column(ForeignKey('book.id'))
font_id = Column(ForeignKey('font.id'))
layout_id = Column(ForeignKey('layout.id'))
font = relationship(Font)
layout = relationship(Layout)
pages = joinedload(Book.pages)
option1 = pages.joinedload(Page.font)
option2 = pages.joinedload(Page.layout)
print([[str(i) for i in load.path] for load in option1._to_bind])
print([[str(i) for i in load.path] for load in option2._to_bind])
option3 = joinedload(Book.pages).joinedload(Page.font)
option4 = joinedload(Book.pages).joinedload(Page.layout)
print([[str(i) for i in load.path] for load in option3._to_bind])
print([[str(i) for i in load.path] for load in option4._to_bind])