On Nov 8, 2011, at 1:34 PM, sector119 wrote:

> Hello.
> 
> Why comments_after_insert_listener return None for target.report - backref 
> for TripReport.comments?

when you do...what exactly?  this is just a mapping, looks fine.    Can you 
provide a fully working example please ?





> 
> class TripReportComment(Base):
>     __tablename__ = 'trip_report_comments'
> 
>     id = Column(Integer, primary_key=True)
>     content = Column(UnicodeText, nullable=False)
>     report_id = Column(Integer, ForeignKey('trip_reports.id'), nullable=False)
> 
> def comments_after_insert_listener(mapper, connection, target):
>     print target.report
> 
> event.listen(TripReportComment, 'after_insert', 
> comments_after_insert_listener)
> 
> class TripReport(Base):
>     __tablename__ = 'trip_reports'
> 
>     id = Column(Integer, primary_key=True)
>     ...
>     comments = relationship('TripReportComment', backref='report', 
> cascade='all, delete-orphan', order_by='TripReportComment.id')
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/sqlalchemy/-/xlOoyFWOAZUJ.
> 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.

-- 
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.

Reply via email to