The docs on Select's where() method say:

> return a new select() construct with the given expression added to its WHERE 
> clause, joined to the existing clause via AND, if any.

But this doesn't seem to happen.

This is my code:

    def posts_per_dow(self, start_date=None, end_date=None):
        q = select([func.date_part('isodow', t_posts.c.created_at),
                    func.count(t_posts.c.id)],
 
t_posts.c.user_id==self.id).group_by('1').order_by('1')

        if start_date: q.where(t_posts.c.created_at>=start_date)
        if end_date: q.where(t_posts.c.created_at<end_date)

Only the first where clause is actually used when I execute the query.

If I'm just going about it wrong, then how do I append a where clause
like this?

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