On 01/30/2016 03:06 PM, Chris Angelico wrote: > That actually violates the SQL spec. Some servers will accept it, > others won't. (You're not supposed to mix column functions and > non-column functions.)
Are you sure? Wikipedia is not always the most accurate place, but they have several clear examples on the SQL page of combining table fields with count() listed. This is straight SQL we're talking about here, not a particular implementation or dialect. Maybe there're some subtleties at play here. > It also can't cope with 'group by' queries, as > it'll count the underlying rows, not the groups. I also suspect it > can't handle join queries. The Wikipedia entry on SQL, which seems to be based in some grounding of the spec, shows that count(), joins, and group by are all compatible with each other. So I dunno! > The original approach is still the most general, and IMO the best. Could be. On the other hand, letting the DB do it all solves his problem without mucking about with async iterators. -- https://mail.python.org/mailman/listinfo/python-list