hi
i have following scenario (excluse the very brief "syntax"):

class BaseAddress:
  street = ... text
class Office( BaseAddress):
  some_fields
class Home( BaseAddress):
  other_fields

class Person:
 home = reference-to-HomeAdrress
 office = reference-to-MainAdrress
 otherstuff

now, i need something like 
query(Person).filter( 
        (Person.home.street == 'foo') 
        & (Person.office.street == 'bar') 
)

should that be something with .join() and then restoring joinpoint, or 
what?

if i write the joins explicitly, like
  query(Person).filter( _and(
        Person.home_id == Home.id,
        Home.street == 'foo', 
        Person.main_id == Office.id,
        Office.street == 'bar' )
)

this does not work, the BaseAddress is used only once instead of being 
aliased...

i know the above query is stupd, can be "optimized", it boils down to 
  query(Person).filter( _and(
        Person.home_id == BaseAddress.id,
        BaseAddress.street == 'foo', 
        Person.main_id == BaseAddress.id,
        BaseAddress.street == 'bar' )
)
and then the need of aliasing is glaring... but this requires a human 
to do it.

can theses alises be somehow made automaticaly ? e.g. multiple access 
to same base table coming from different "subclasses" -> alias 

ciao
svilen

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