diff options
| author | Tim Graham <timograham@gmail.com> | 2018-11-09 19:09:36 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-09 19:09:36 -0500 |
| commit | f82be9ebc79e30fef796bbc61fec4b9694cb779f (patch) | |
| tree | c4a5907223c04a3f005612543abea418234afe5c /django | |
| parent | f9ff1df1daac8ae1fc22b27f48735148cb5488dd (diff) | |
Fixed #29934 -- Added sqlparse as a require dependency.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/base/features.py | 4 | ||||
| -rw-r--r-- | django/db/backends/base/operations.py | 17 | ||||
| -rw-r--r-- | django/db/backends/postgresql/features.py | 1 |
3 files changed, 6 insertions, 16 deletions
diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py index dbbb5a796f..8fec545486 100644 --- a/django/db/backends/base/features.py +++ b/django/db/backends/base/features.py @@ -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 = '' diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py index 7296fd0e67..2a2227435d 100644 --- a/django/db/backends/base/operations.py +++ b/django/db/backends/base/operations.py @@ -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): """ diff --git a/django/db/backends/postgresql/features.py b/django/db/backends/postgresql/features.py index 148e0766ed..4fae7b1d34 100644 --- a/django/db/backends/postgresql/features.py +++ b/django/db/backends/postgresql/features.py @@ -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 |
