#30988: Deprecate the barely documented InvalidQuery exception.
-------------------------------------+-------------------------------------
               Reporter:  Simon      |          Owner:  nobody
  Charette                           |
                   Type:             |         Status:  new
  Cleanup/optimization               |
              Component:  Database   |        Version:  master
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 The `django.db.models.query.InvalidQuery` exception is
 [https://docs.djangoproject.com/en/2.2/topics/db/sql/#deferring-model-
 fields only mentioned once by name in the documentation] without reference
 to its defining module.

 It's used for the documented `QuerySet.raw` usage and
 
[https://github.com/django/django/blob/4527d5db0f0a939439b9373f7a9a4eee3386afff/django/db/models/query_utils.py#L23
 abused] for
 
[https://github.com/django/django/blob/4527d5db0f0a939439b9373f7a9a4eee3386afff/django/db/models/query_utils.py#L221-L254
 field deferring select related misuse].

 I suggest we replace the documented usage by raising `FieldDoesNotExist`
 instead and the latter undocumented abuse by raising `FieldError` while
 providing a deprecation shim to warn on usages of `except InvalidQuery`.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.681b9ec341fc0f6cdd4f1a01af20818e%40djangoproject.com.

Reply via email to