|
4 | 4 | import json |
5 | 5 |
|
6 | 6 | from django import VERSION |
| 7 | +from django.db import NotSupportedError |
7 | 8 | from django.db.models import BooleanField, Value |
8 | | -from django.db.models.functions import Cast |
| 9 | +from django.db.models.functions import Cast, NthValue |
9 | 10 | from django.db.models.functions.math import ATan2, Log, Ln, Mod, Round |
10 | 11 | from django.db.models.expressions import Case, Exists, OrderBy, When, Window |
11 | 12 | from django.db.models.lookups import Lookup, In |
@@ -51,6 +52,10 @@ def sqlserver_mod(self, compiler, connection): |
51 | 52 | ) |
52 | 53 |
|
53 | 54 |
|
| 55 | +def sqlserver_nth_value(self, compiler, connection, **extra_content): |
| 56 | + raise NotSupportedError('This backend does not support the NthValue function') |
| 57 | + |
| 58 | + |
54 | 59 | def sqlserver_round(self, compiler, connection, **extra_context): |
55 | 60 | return self.as_sql(compiler, connection, template='%(function)s(%(expressions)s, 0)', **extra_context) |
56 | 61 |
|
@@ -186,6 +191,7 @@ def json_HasKeyLookup(self, compiler, connection): |
186 | 191 | Ln.as_microsoft = sqlserver_ln |
187 | 192 | Log.as_microsoft = sqlserver_log |
188 | 193 | Mod.as_microsoft = sqlserver_mod |
| 194 | +NthValue.as_microsoft = sqlserver_nth_value |
189 | 195 | Round.as_microsoft = sqlserver_round |
190 | 196 | Window.as_microsoft = sqlserver_window |
191 | 197 |
|
|
0 commit comments