Greetings, I have an object model which I'm persisting with
SQLAlchemy (0.6.3). I have a need for one of the objects in the model
to always merge itself into the session when a new instance is added.
For example, given
sub = Subscription(email=EmailAddress(value='[email protected]))
which will then be added to the model via a dynaimc_loader backed by
an AppenderQuery
model.lists[0].subscriptions.append(sub)
Given the EmailAddress model enforces uniqueness of the value, I want
the EmailAddress instance to merge itself into the session without me
having to manually query for it.
So far I've explored a SessionExtension and manually passing the
session into the constructor using a trick I found while searching
around on this group:
sub = Subscription(email=EmailAddress(session=session,
value='[email protected]))
This does exactly what I want it to but is less than desirable from a
usability perspective. I've had no luck with a SessionExtension. Any
recommendations?
Thanks!
--
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.