Opened 9 years ago
Closed 4 years ago
#26061 closed Bug (duplicate)
Empty queryset raises EmptyResultSet (instead of print SQL query)
Reported by: | Adam Dobrawy | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 3.1 |
Severity: | Normal | Keywords: | EmptyResultSet |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Internal Server Error: /api/travel/places/ Traceback (most recent call last): File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(*args, **kwargs) File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/rest_framework/viewsets.py", line 125, in view return self.dispatch(request, *args, **kwargs) File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch response = self.handle_exception(exc) File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception raise exc File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, **kwargs) File "/Users/User/Projects/travel/travel_backend/travel/views.py", line 2141, in export sql, params = queryset.none().query.sql_with_params() File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/django/db/models/sql/query.py", line 264, in sql_with_params return self.get_compiler(DEFAULT_DB_ALIAS).as_sql() File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 513, in as_sql where, w_params = self.compile(self.where) if self.where is not None else ("", []) File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 430, in compile sql, params = node.as_sql(self, self.connection) File "/Users/User/Projects/travel_envs/back_env/lib/python3.8/site-packages/django/db/models/sql/where.py", line 99, in as_sql raise EmptyResultSet django.core.exceptions.EmptyResultSet
AnyModel.objects.none().query.sql_with_params() raises django.core.exceptions.EmptyResultSet
Change History (5)
comment:1 by , 9 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:3 by , 4 years ago
Resolution: | duplicate |
---|---|
Status: | closed → new |
comment:4 by , 4 years ago
Description: | modified (diff) |
---|---|
Summary: | Queryset raises EmptyResultSet (instead of print SQL query) → Empty queryset raises EmptyResultSet (instead of print SQL query) |
Version: | 1.8 → 3.1 |
comment:5 by , 4 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
This ticket reports the same issue as #22973, therefore it's a duplicate. That ticket is closed as wontfix because the behavior is by design.
Note:
See TracTickets
for help on using tickets.
Duplicate of #22973