droolz wrote: > > mapper(ArkInvoice, invoices_table, properties={ > 'entries': relation(ArkInvoiceEntry, > secondary=invoice_entries_primary_table, backref='invoice', > cascade="all, delete, delete-orphan"), > 'user': relation(ArkUsers, backref='user'), > 'child_invoices':relation(ArkInvoice, > backref=backref('parent_invoice', > remote_side=[invoices_table.c.id]), > cascade="all", > lazy=False, > join_depth=3) > }) > > The idea behind this is that invoices can have a hierarchy, and some > invoices are effectively parented under a parent invoice. This > parenting only ever needs to be one level deep. > > The problem I'm having is child_invoices works fine for the parent > ArkInvoice object, however none of the children seem to receive a > backref, in so much as type(invoiceObject.parent_invoice) is a > 'NoneType', yet I would expect it to return the parent arkInvoice > obhject. >
the mapping seems perfect to me. parent_invoice would only be None for the actual parent. perhaps there's some issue with your usage. check your SQL echoing to make sure things are as expected. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---