Alessandro Dentella wrote: > > Hi, > > I have a definition similar to this:: > > class Ticket(Base): > __tablename__ = 'ticket' > id = Column(Integer, primary_key=True) > assigned_to_id = Column(ForeignKey(User.id)) > > assigned_to = relation(User, primaryjoin = assigned_to_id == User.id, > lazy=True) > > If I instantiate > > ticket = Ticket() > ticket.assigned_to_id = user.id > > I can commit and after that I can 'print ticket.assigned_to'
specifically the lazy loader will work in the "after_flush_postexec()" phase of the sessionextension. during after_flush(), the post-flush bookkeeping has not been establishsed yet on assigned_to_id, and the lazy loader always looks for the "persisted" version of the attribute. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
