1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #29934 -- Added sqlparse as a require dependency.

This commit is contained in:
Tim Graham
2018-11-09 19:09:36 -05:00
committed by GitHub
parent f9ff1df1da
commit f82be9ebc7
10 changed files with 29 additions and 61 deletions

View File

@@ -194,10 +194,6 @@ class BaseDatabaseFeatures:
# Does 'a' LIKE 'A' match?
has_case_insensitive_like = True
# Does the backend require the sqlparse library for splitting multi-line
# statements before executing them?
requires_sqlparse_for_splitting = True
# Suffix for backends that don't support "SELECT xxx;" queries.
bare_select_suffix = ''

View File

@@ -2,8 +2,9 @@ import datetime
import decimal
from importlib import import_module
import sqlparse
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import NotSupportedError, transaction
from django.db.backends import utils
from django.utils import timezone
@@ -298,16 +299,10 @@ class BaseDatabaseOperations:
cursor.execute() call and PEP 249 doesn't talk about this use case,
the default implementation is conservative.
"""
try:
import sqlparse
except ImportError:
raise ImproperlyConfigured(
"The sqlparse package is required if you don't split your SQL "
"statements manually."
)
else:
return [sqlparse.format(statement, strip_comments=True)
for statement in sqlparse.split(sql) if statement]
return [
sqlparse.format(statement, strip_comments=True)
for statement in sqlparse.split(sql) if statement
]
def process_clob(self, value):
"""

View File

@@ -26,7 +26,6 @@ class DatabaseFeatures(BaseDatabaseFeatures):
nulls_order_largest = True
closed_cursor_error_class = InterfaceError
has_case_insensitive_like = False
requires_sqlparse_for_splitting = False
greatest_least_ignores_nulls = True
can_clone_databases = True
supports_temporal_subtraction = True