Update query catching and comparison for Django 4.2.

Review Request #13453 — Created Dec. 7, 2023 and submitted

Information

Djblets
release-5.x

Reviewers

The new query catching and comparison code introduced in Djblets 3.4
wasn't quite compatible with Django 4.2, due to some changes in how some
queries and Q-expressions are built.

COUNT(*) queries are now generated slightly differently, with
different internals, affecting query expectations. This has been
updated in Djblets's tests, but this will impact consumers of query
comparison code outside of Djblets as well.

SQLite query syntax has changed for some operations, affecting Djblets
unit tests.

~Q(...) negated expressions are now represented differently
internally, using a NegatedExpression (a subclass of
ExpressionWrapper). These are now supported, serialized, represented,
and compared correctly.

Unit tests pass.

Summary ID
Update query catching and comparison for Django 4.2.
The new query catching and comparison code introduced in Djblets 3.4 wasn't quite compatible with Django 4.2, due to some changes in how some queries and Q-expressions are built. `COUNT(*)` queries are now generated slightly differently, with different internals, affecting query expectations. This has been updated in Djblets's tests, but this will impact consumers of query comparison code outside of Djblets as well. SQLite query syntax has changed for some operations, affecting Djblets unit tests. `~Q(...)` negated expressions are now represented differently internally, using a `NegatedExpression` (a subclass of `ExpressionWrapper`). These are now supported, serialized, represented, and compared correctly.
cb23421cda3dc081c972e368c29ae06617ed49bb
Description From Last Updated

'django.db.models.expressions.ExpressionWrapper' imported but unused Column: 1 Error code: F401

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.x (01a7f23)