On Apr 13, 2007, at 3:10 PM, [EMAIL PROTECTED] wrote:

>>
>> then:
>>
>> m = session.query(MyClass).get(1)
>> somechildren = m.children[3:5]
>> someotherchildren = m.children.filter_by(foo='bar').filter_by
>> (x==y).list()
>>
> hm, that seems like a way... more or less what i've done so far, on a
> different level though - i have done it completely separate.
>
> how to avoid loading the whole thing at any time?

Query is a generative object now.  the return value hasnt loaded  
anything until you call list(), select(), __iter__(), or a range  
function on it.

> or there is no
> relation() as such? with_parent assumes some relation.

yes with_parent assumes the relation, otherwise you have to spell out  
the join criterion manually.

> and how to add new links - manualy? or append to the otherside? then
> how to re-sync the list - items can be added on other machines/
> threads...?

we arent writing to anything here, this is strictly a read-only  
function.  if you want to modify the collection, you create a real  
relation() separately.  the controversy was over should the relation 
() and the generative loader be mixed (which I think they should not,  
even though its slightly more verbose...surprise).

>
> i want to somehow bundle these (read/write aspects) in one thing, e.g.
> called "specialized_relation", and not having to separately think
> about intermediate objects/queries etc.

yes i am not comfortable with combining them as Gaetan suggested  
since i think it conflates two semantic purposes in one attribute,  
one purpose being the management of data in the database, the other  
being a view.  in particular you really cant have your partial loaded  
list actually populate the underlying collection since it will only  
be partially populated and ruin the semantics of what it means to be  
a "relation".




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