[Django] #35547: reset_queries cannot be imported from django.db

23 views
Skip to first unread message

Django

unread,
Jun 20, 2024, 3:12:06 PM6/20/24
to django-...@googlegroups.com
#35547: reset_queries cannot be imported from django.db
-------------------------------------+-------------------------------------
Reporter: | Owner: AjmalPonneth
AjmalPonneth |
Type: | Status: assigned
Cleanup/optimization |
Component: Database | Version: 5.0
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
Currently, the reset_queries method cannot be imported from `django.db`.
--
Ticket URL: <https://code.djangoproject.com/ticket/35547>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 20, 2024, 3:25:54 PM6/20/24
to django-...@googlegroups.com
#35547: reset_queries cannot be imported from django.db
-------------------------------------+-------------------------------------
Reporter: AjmalPonneth | Owner:
Type: | AjmalPonneth
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by AjmalPonneth):

PR: https://github.com/django/django/pull/18292
--
Ticket URL: <https://code.djangoproject.com/ticket/35547#comment:1>

Django

unread,
Jun 21, 2024, 9:50:42 AM6/21/24
to django-...@googlegroups.com
#35547: reset_queries cannot be imported from django.db
-------------------------------------+-------------------------------------
Reporter: AjmalPonneth | Owner:
Type: | AjmalPonneth
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Unreviewed => Accepted

Comment:

Thank you, this is [https://docs.djangoproject.com/en/5.0/faq/models/#how-
can-i-see-the-raw-sql-queries-django-is-running documented] and so we
should be able to import 👍
--
Ticket URL: <https://code.djangoproject.com/ticket/35547#comment:2>

Django

unread,
Jun 21, 2024, 9:51:44 AM6/21/24
to django-...@googlegroups.com
#35547: reset_queries cannot be imported from django.db
-------------------------------------+-------------------------------------
Reporter: AjmalPonneth | Owner:
Type: | AjmalPonneth
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* has_patch: 0 => 1
* needs_better_patch: 0 => 1

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

Django

unread,
Jun 21, 2024, 11:24:00 AM6/21/24
to django-...@googlegroups.com
#35547: reset_queries cannot be imported from django.db
-------------------------------------+-------------------------------------
Reporter: AjmalPonneth | Owner:
Type: | AjmalPonneth
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin

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

Django

unread,
Jun 21, 2024, 12:29:34 PM6/21/24
to django-...@googlegroups.com
#35547: reset_queries cannot be imported from django.db
-------------------------------------+-------------------------------------
Reporter: AjmalPonneth | Owner:
Type: | AjmalPonneth
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Tim Graham):

I think the summary is slightly misleading. It can be imported with `from
django.db import reset_queries` but not with `from django.db import *`,
right?
--
Ticket URL: <https://code.djangoproject.com/ticket/35547#comment:5>

Django

unread,
Jun 23, 2024, 12:03:02 PM6/23/24
to django-...@googlegroups.com
#35547: reset_queries cannot be imported from django.db
-------------------------------------+-------------------------------------
Reporter: AjmalPonneth | Owner:
Type: | AjmalPonneth
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by AjmalPonneth):

Currently, the `reset_queries` function is not importable from
`django.db`. Since it's not included in the ` __all__` from `django.db`.
--
Ticket URL: <https://code.djangoproject.com/ticket/35547#comment:6>

Django

unread,
Jun 23, 2024, 2:15:14 PM6/23/24
to django-...@googlegroups.com
#35547: reset_queries cannot be imported from django.db
-------------------------------------+-------------------------------------
Reporter: AjmalPonneth | Owner:
Type: | AjmalPonneth
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Mariusz Felisiak):

Replying to [comment:6 AjmalPonneth]:
> Currently, the `reset_queries` function is not importable from
`django.db`. Since it's not included in the ` __all__` from `django.db`.

That's not true. `reset_queries` can be imported from `django.db` even
without including it in `__all__`, e.g.
https://github.com/django/django/blob/7ba2a0db20c37a5b1500434ca4ed48022311c171/django/test/utils.py#L25.
--
Ticket URL: <https://code.djangoproject.com/ticket/35547#comment:7>
Reply all
Reply to author
Forward
0 new messages