> - two big new Query features, which are temporarily underscored until
> we get some feedback on them:  _values(), which limits the Query to
> returning just tuples of specfic columns as in
> query.filter(...)._values(A.id, A.name),



Wouldn't this kind of feature be more natural to include in the Query
constructor itself, to make Query() somewhat orthogonal with select()?

i.e.
         session.query([MappedObject.id,
MappedObject.name]).filter(...).all()

instead of
         session.query(MappedObject).filter(...).values(MappedObject.id,
MappedObject.name).all()


This is along the lines of the "Query() as a mapper-aware select()" as was
discussed on the -dev list a bit back.  I had imagined an interface like
this:

"""
If a single mapped object is passed as the sole argument to Query(), it
performs as before, i.e. SelectResults() / SQLAlchemy 3.x compatible.
But if a list of items is given to Query() as it would be for select(),
Query instead returns tuples.

So
         session.query(MappedObject).filter(...).all()

would return a list of mapped objects a-la SelectResults/SQLAlchemy 3.x
style:
       [obj1, obj2, obj3]


whereas
         session.query([MappedObject, MappedObject.id,
MappedObject.name]).filter(...).all()

would return a list of three-tuples:
        [
        (obj1, id1, name1),
        (obj2, id2, name2)
        (obj3, id3, name3)
        ]

"""


Rick

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