Hello.

Suppose I have the following query:

def people_older_than(age):
    q = session.query(Person).order_by(Person.name)
    q = q.filter(Person.age > age)
    return q

It returns a subset of Person instances. How can I augment the query so it
returns only their count? I.e.:

def number_of_people_older_than(age)
    q = people_older_than(21)
    q_count = q    # Apply some magic here.
    return q_count.scalar()


Thank you in advance,

Ladislav Lenart

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to