[sqlalchemy] Re: how to make a query for multilevel reference?

2007-01-26 Thread svilen
okay, how would u do something like (person.address1.country.name == 'France' or person.address2.country.name == 'Germany') note there are 2 different address1 and address2 fields of the person. and, how would this be like: (person.address1.country.name == 'France' or person.company.name

[sqlalchemy] Re: how to make a query for multilevel reference?

2007-01-23 Thread Michael Bayer
svilen wrote: But then query.select_by( name='whatever') may find different .name 's in the obj.hierarchy depending on dict.hashes/iteration, within same run or between different runs, returning very different queries... then just use select() for more specificity. Which means - cripple

[sqlalchemy] Re: how to make a query for multilevel reference?

2007-01-23 Thread svilen
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

[sqlalchemy] Re: how to make a query for multilevel reference?

2007-01-23 Thread Michael Bayer
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,

[sqlalchemy] Re: how to make a query for multilevel reference?

2007-01-21 Thread sdobrev
Lets have a Person having .address having .country having .name. How would give-me-persons-which-live-in France be expressed in SA (sorry for my SQL ignorance)? e.g. all-persons-for-which person.address.country.name == 'France'

[sqlalchemy] Re: how to make a query for multilevel reference?

2007-01-21 Thread Michael Bayer
how about q = session.query(D) q.select(q.join_via([address, country]) (Country.c.name == 'france')) or q = SelectResults(session.query(D)) q.join_to(address).join_to(country).select(Country.c.name=='france') im not down with shoving literal strings into **kwargs at all

[sqlalchemy] Re: how to make a query for multilevel reference?

2007-01-21 Thread Rick Morrison
Hey what's with the bitwise AND operator? Does that actually work to AND together parts of WHERE clauses? On 1/21/07, Michael Bayer [EMAIL PROTECTED] wrote: how about q = session.query(D) q.select(q.join_via([address, country]) (Country.c.name == 'france')) or q =

[sqlalchemy] Re: how to make a query for multilevel reference?

2007-01-21 Thread Michael Bayer
yes, although its a little inconvenient because it takes a high precedence in the order of operations (thus you have to put () around all expressions) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy