Hey,

[finding related objects]

One way I've come up with is this:


m = object_mapper(model)
for prop in m.iterate_properties:
     if isinstance(prop, RelationProperty):
         if prop.direction is ONETOMANY:
             for related in getattr(model, prop.key):
                 do_stuff(related)

the other directions still need to be handled though (and recursion).

Would this be a reasonable solution?

Regards,

Martijn


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

Reply via email to