On Apr 13, 2007, at 12:51 PM, [EMAIL PROTECTED] wrote:
> haven't thought yet of where/how to hack this...
> i may have to abandon *-to-many-relations() alltogether, as i don't
> want/need them loaded - only filtered at view-time.
> or can i make some super- (or sub-) relation thing (propertyLoader?)
> that does the above?

I currently do it using a property that returns a Query object, which  
works very well.  the extra method "with_parent()" i want to add to  
Query would make it easier to implement also.


class MyClass(object):
     def _get_children(self):
          return object_session(self).query 
(SomeChildClass).with_parent(self)
     children = property(_get_children)


then:

m = session.query(MyClass).get(1)
somechildren = m.children[3:5]
someotherchildren = m.children.filter_by(foo='bar').filter_by 
(x==y).list()



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

Reply via email to