[Django] #32058: Add count to RawQueryset

100 views
Skip to first unread message

Django

unread,
Sep 30, 2020, 8:47:06 PM9/30/20
to django-...@googlegroups.com
#32058: Add count to RawQueryset
-------------------------------------------+------------------------
Reporter: jkevingutierrez | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
count() doesn't exist in RawQuerySet. It would be good to have the count
method


Here is an implementation:
https://stackoverflow.com/a/18179123/4508187

--
Ticket URL: <https://code.djangoproject.com/ticket/32058>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 30, 2020, 8:49:11 PM9/30/20
to django-...@googlegroups.com
#32058: Add count to RawQueryset
---------------------------------+--------------------------------------

Reporter: jkevingutierrez | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Description changed by jkevingutierrez:

Old description:

> count() doesn't exist in RawQuerySet. It would be good to have the count
> method
>

> Here is an implementation:
> https://stackoverflow.com/a/18179123/4508187

New description:

count() doesn't exist in RawQuerySet. It would be good to have the count
method

`AttributeError: 'RawQuerySet' object has no attribute 'count'`

--

--
Ticket URL: <https://code.djangoproject.com/ticket/32058#comment:1>

Django

unread,
Sep 30, 2020, 8:49:33 PM9/30/20
to django-...@googlegroups.com
#32058: Add count to RawQueryset
---------------------------------+--------------------------------------

Reporter: jkevingutierrez | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Description changed by jkevingutierrez:

Old description:

> count() doesn't exist in RawQuerySet. It would be good to have the count
> method
>


> `AttributeError: 'RawQuerySet' object has no attribute 'count'`
>

> Here is an implementation:
> https://stackoverflow.com/a/18179123/4508187

New description:

count() doesn't exist in RawQuerySet.

`AttributeError: 'RawQuerySet' object has no attribute 'count'`


--

--
Ticket URL: <https://code.djangoproject.com/ticket/32058#comment:2>

Django

unread,
Oct 1, 2020, 2:10:09 AM10/1/20
to django-...@googlegroups.com
#32058: Add count to RawQueryset
---------------------------------+--------------------------------------

Reporter: jkevingutierrez | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

Comment (by Mahanth kumar):

But count() exists in FlatValuesListIterable , Can't we use that ?

I'm new here

--
Ticket URL: <https://code.djangoproject.com/ticket/32058#comment:3>

Django

unread,
Oct 1, 2020, 3:25:14 AM10/1/20
to django-...@googlegroups.com
#32058: Add count() to RawQuerySet.
-------------------------------------+-------------------------------------
Reporter: jkevingutierrez | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => wontfix
* type: Uncategorized => New feature
* component: Uncategorized => Database layer (models, ORM)


Comment:

Thanks for this ticket, however `RawQuerySet` doesn't implement all
methods you can use with `QuerySet` and is not intended to do this. We
cannot mirror `QuerySet.count()` because there is no
annotation/aggregation mechanism in `RawQuerySet` and wrapping a raw SQL
(suggested in stack overflow) can be clunky. You can start a discussion on
DevelopersMailingList if you don't agree.

------
Replying to [comment:3 Mahanth kumar]:
> But count() exists in Queryset , Can't we use that ?

No, these are different classes.

--
Ticket URL: <https://code.djangoproject.com/ticket/32058#comment:4>

Reply all
Reply to author
Forward
0 new messages