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' > > Is there a way to have ticket_assigned_to available *before* committing? > I'd like to have it available in after-flush phase of sessionExtension.
as soon as Ticket is persistent within the flush, the ticket.assigned_to relation will be "live" and will lazy load when accessed. no commit is needed. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---