Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mssql/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
from django.db.transaction import TransactionManagementError
from django.db.utils import NotSupportedError
if django.VERSION >= (3, 1):
from django.db.models.fields.json import compile_json_path, KeyTransform as json_KeyTransform
from django.db.models.fields.json import KeyTransform as json_KeyTransform
if django.VERSION >= (3, 1) and django.VERSION < (6, 0):
from django.db.models.fields.json import compile_json_path
if django.VERSION >= (4, 2):
from django.core.exceptions import EmptyResultSet, FullResultSet

Expand Down Expand Up @@ -47,7 +49,7 @@ def _as_sql_greatest(self, compiler, connection):

def _as_sql_json_keytransform(self, compiler, connection):
lhs, params, key_transforms = self.preprocess_lhs(compiler, connection)
json_path = compile_json_path(key_transforms)
json_path = connection.ops.compile_json_path(key_transforms)
return (
"COALESCE(JSON_QUERY(%s, '%s'), JSON_VALUE(%s, '%s'))" %
((lhs, json_path) * 2)
Expand Down