I am using SA 0.3.11 and I would like to know if there is a way to get
a query object from a relation property.  I have several one-to-many
relationships in my application.  These are all setup and work very
well, but I find that I often want to perform further filtering of the
objects in the relationship list property.  I could write python code
to do it, but if I could get SA to do it on the server, then all the
better.

To be more specific, here is an example from the SA documentation:

mapper(Address, addresses_table)
mapper(User, users_table, properties = {
        'addresses' : relation(Address)
    }
  )

user_fred = session.query(User).filter_by(user_name="fred")

# Is it possible to do something like this?
fred_ny_addresses = getQuery(user_fred.addresses).filter_by(state="NY")


I know that SA 0.4 has support for dynamic_loader properties which
would be fairly similar to this, but I am stuck with 0.3.11 for now.
I think what I want is also a bit different then a dynamic_loader
because 95% of the time I want to use it as a standard relation
property and the performance is not such that I am worried about
loading the entire list of Address entities.  All I want is a shortcut
for creating a query object with the same settings as those used for
the query used to create the list for the relation property.

Is this possible in any way?

Thanks,
Allen

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