Talking to myself, here; always a bad sign...

On Mon, 2006-03-06 at 14:19 +1100, Malcolm Tredinnick wrote:
> On Sun, 2006-03-05 at 18:06 -0800, tgone wrote:
> > Malcolm Tredinnick wrote:
> > > The 'fields' keyword argument is specific to get_values() because it
> > > specifies the fields you want returned. The get_count() method returns
> > > an integer -- you don't get a choice there -- so there is no 'fields'
> > > argument required or permitted, only lookup constraints
> > > (artist__icontains, etc).
> > 
> > You're right, the error goes away when I remove the 'fields' keyword.
> > However, the count is way off (it's not counting distinct rows). How do
> > you count distinct rows?
> 
> Yeah... it looks like count(distinct(*)) queries are not being
> constructed. I just tested the equivalent case in the magic-removal
> branch and it's doing the wrong thing there.

Well, count(distinct(*)) is a good example of not-SQL. :-(

But it would still be nice to be able to do what you were trying to do
initially: select count(distinct(some_field)) from my_table. Presently,
you have to have retrieve all the data from the get_values() call and
then take then len() of the result, which isn't quite as efficient.

Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to