this would basically conflate the concepts of a mapped entity with
query criterion.  while you can do both queries with the orm Query
object, it does not pull criterion from the entity itself.  object
oriented design principles would generally dictate that a different
kind of object should be used to build query criterion vs. the object
that represents the data (the central question in OO is, is it true
that an instance of X "is an" instance of Y?  is my mapped entity also
a query criterion object ?)

however, im not one to discourage experimentation.  the good news for
you is that you can write your own MapperExtension that supplies its
own select_by(), where you can add the code to pull out the criterion
from your transient instance and pass it along to the query objects
regular "select" or "select_whereclause" method.

this code would look something like:

query.options(extension(MyCriterionExtension(dbPeople)).select_by(<whatever>)

the "extension" option, which allows you to specify a MapperExtension
as an option, is in 0.2.8 but is temporarily absent from the trunk
pending some refactoring...it will be back in 0.3.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" 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/sqlalchemy
-~----------~----~----~----~------~----~------~--~---

Reply via email to