Hi Folks,

I have two short questions regarding the associables. Let's suppose I
have a case like the unit test in <http://elixir.ematia.de/trac/
browser/elixir/trunk/tests/test_associable.py>. Let's look on line 80
of that code:

people = Person.select_by_addresses(city='Cupertino')

My questions are the following:

(1) Why is the <Entity>.select_by_<associable>() syntax the only one
that works here? <Entity>.query.filter_by() doesn't work, which in
counter-intuitive to me. This bothers me, as I would like to have more
complex queries that I can stack unto each other. However,
the .select_by.<associable> syntax returns the list of objects right
away, so that I cannot build up a complex query as I could have
with .query.filter_by()

(2) Back to the example line 80, is there any way I can query for a
person by the Address object directly? Right now I have only figured
out how to do it via its city field, but not via the object reference
of the Address itself. Of course you could do it via the unique id of
the Address if you mean a specific object, but that doesn't sound very
elegant to me. Let's suppose I have a reference to a Address object
already and I know that it is associated to one or more Persons, how
can I best retrieve these persons?

a = Address()
Person.query.filter_by(addresses=a).all()

always returns an empty list, even if

a in Person.query.all()[0].addresses == True


Thanks for your help.

Cheers, sven

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to