summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3/base.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2020-07-28 13:06:52 +0200
committerGitHub <noreply@github.com>2020-07-28 13:06:52 +0200
commitba691933cee375195c9c50f333dd4b2a3abbb726 (patch)
treefa800770d47600f66d9a5164861b06d1e114e36b /django/db/backends/sqlite3/base.py
parent7dbbe65647a54283fadf2c51f11a750a74425d7b (diff)
Fixed #31836 -- Dropped support for JSONField __contains and __contained_by lookups on SQLite.
The current implementation works only for basic examples without supporting nested structures and doesn't follow "the general principle that the contained object must match the containing object as to structure and data contents, possibly after discarding some non-matching array elements or object key/value pairs from the containing object".
Diffstat (limited to 'django/db/backends/sqlite3/base.py')
-rw-r--r--django/db/backends/sqlite3/base.py10
1 files changed, 0 insertions, 10 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index 26863d282f..8a105d4f35 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -5,7 +5,6 @@ import datetime
import decimal
import functools
import hashlib
-import json
import math
import operator
import re
@@ -235,7 +234,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
create_deterministic_function('DEGREES', 1, none_guard(math.degrees))
create_deterministic_function('EXP', 1, none_guard(math.exp))
create_deterministic_function('FLOOR', 1, none_guard(math.floor))
- create_deterministic_function('JSON_CONTAINS', 2, _sqlite_json_contains)
create_deterministic_function('LN', 1, none_guard(math.log))
create_deterministic_function('LOG', 2, none_guard(lambda x, y: math.log(y, x)))
create_deterministic_function('LPAD', 3, _sqlite_lpad)
@@ -601,11 +599,3 @@ def _sqlite_lpad(text, length, fill_text):
@none_guard
def _sqlite_rpad(text, length, fill_text):
return (text + fill_text * length)[:length]
-
-
-@none_guard
-def _sqlite_json_contains(haystack, needle):
- target, candidate = json.loads(haystack), json.loads(needle)
- if isinstance(target, dict) and isinstance(candidate, dict):
- return target.items() >= candidate.items()
- return target == candidate