Django 4 came with some changes to the `query.py` file, now we don't have the `self.explain_query = False` anymore, so this error is thrown.  Django 3.x `query.py` file: https://github.com/django/django/blob/stable/3.2.x/django/db/models/sql/query.py#L245 Django 4.x `query.py` file: https://github.com/django/django/blob/main/django/db/models/sql/query.py#L227 Error location: https://github.com/ESSolutions/django-mssql-backend/blob/master/sql_server/pyodbc/compiler.py#L294