Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#30988 closed Cleanup/optimization (fixed)

Deprecate the barely documented InvalidQuery exception.

Reported by: Simon Charette Owned by: Simon Charette
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The django.db.models.query.InvalidQuery exception is ​only mentioned once by name in the documentation without reference to its defining module.

It's used for the documented QuerySet.raw usage and ​abused for ​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.

Change History (3)

comment:1 by Mariusz Felisiak, 7 years ago

Has patch: set
Owner: changed from nobody to Simon Charette
Status: new → assigned
Triage Stage: Unreviewed → Accepted

comment:2 by Mariusz Felisiak <felisiak.mariusz@…>, 7 years ago

Resolution: → fixed
Status: assigned → closed

In 11e327a3:

Fixed #30988 -- Deprecated the InvalidQuery exception.

It was barely documented without pointers at its defining location and
was abused to prevent misuse of the QuerySet field deferring feature.

comment:3 by Mariusz Felisiak <felisiak.mariusz@…>, 6 years ago

In 68e3ca13:

Refs #30988 -- Removed InvalidQuery exception per deprecation timeline.

Note: See TracTickets for help on using tickets.
Back to Top