yes, if you have two relations at the *same* level, both of which  
will lead to the same named property within, then select_by() by  
itself is useless.   if you are querying for a relaton that you think  
is local, and its not and then it magically traverses down and finds  
the wrong property, then its wrong regardless of whether multiple  
matching relationships exist or not...you expected it to only remain  
within the first level.  the error in that behavior will become  
apparent very quickly.  if you are relying upon the "deep" traversal  
behavior, then you'd better know what youre doing.   so far, nobody's  
ever had a problem with it.  my litmus test to remove an API and  
replace with something else usually starts with "users keep getting  
errors with the current API", so this is not hitting that point yet.

the best way by far is to just use SelectResults and be explicit.  I  
should add a select_by() to SelectResults though.  im not thrilled  
with the inconvenience of using SelectResults and wish I had written  
Query to be more like it in the first place; but it is a different  
approach than Query and I would rather not conflate the two approaches.

On Jan 23, 2007, at 12:53 PM, svilen wrote:

>
>>> Which means - cripple the _locate_prop() to look only 1 level
>>> down, making it predictable.
>>
>> it will match the first level it finds.  its predictable.
> you have multiple levels of dictionaries. Traversing them is not
> really predictable (although stable if noone changes them, within
> same run).
>
> So if there is:
> class Address:
>    street =Text()
>
> class Person:
>   address_real = Address()
>   address_official = Address()
>   mother = Person()
>
> traversing through some person's attributes may in one run first
> find .street in person.address_real, in another run (or later in same
> run) in person.address_official.
>
> thus it's not really predictable.
>
> okay, i'm not arguing, maybe just put some warning about it in the
> doco or something. Making some dictionaries ordered maybe also a way,
> if dynamic adding of attributes/relations is not allowed.
>
> ciao
> svil
>
> >


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