Another technique to think about would be to enumerate the child addresses
with a small integer value, say "sequence". You can then add the "order_by"
to the relation to fetch the addresses in sequence order, and by convention
the first address in the result list -- the one with min(sequence) in the
group -- is the default address. If you then use 'dynamic' on the relation,
you can fetch only the first (and default) address by using .first() on the
resulting Query object, or .all() to get all the addresses. A small side
benefit is that if the default address is then deleted, the next in line
will become the new default.

Of course the price of this behavior is to maintain the sequences, but
that's pretty straightforward.

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

Reply via email to