Thanks! I went with
Appointment.persons = relationship(
'AppointmentPerson',
cascade='delete-orphan, delete, save-update, merge, expunge',
lazy=LAZYJOIN)
and used the slice notation to empty the InstrumentedList:
appt.persons[:] = []
In my real app, I spent some time trying to figure out why the appt.persons
collection remained empty when I created new AppointmentPersons.
When I had the original lazy=dynamic relationship, the magic Query
collection
automatically got populated as I created new AppointmentPersons.
Eventually I shrugged and decided to append them to appt.persons in this
update case.
Regarding the empty-the-collection-then-append-possibly-identical-objects
pattern,
how do you feel about that? Is there a straightforward way to do it more
efficiently?
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.