On Oct 23, 2008, at 1:32 PM, Hinrich Winther wrote: > Hi, > > I have tried to implement all day now. The problem is, that the > values of the parent chartItem are populated by sqlalchemy after a > flush. But I would have to extract the value by the parent before a > flush, otherwise the db complains becuause sqllite would also try to > flush the child at the same time. I only see 2 ways out of this > chicken / egg dilemma:
you implement a routine *inside* the flush() using a MapperExtension configured on the chartItem mapper, using the before_insert() routine. This would receive chartItem objects, and if patID is not populated, you would traverse up the parents of that chartItem until you located a non-None patID; then populate. The unit of work will ensure that the patient object is INSERTed before the child chartItem objects. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---