diff --git a/django_redshift_backend/__init__.py b/django_redshift_backend/__init__.py index 2a5c690..a1bf1dd 100644 --- a/django_redshift_backend/__init__.py +++ b/django_redshift_backend/__init__.py @@ -1,4 +1,4 @@ -from django_redshift_backend.meta import DistKey, SortKey # noqa +from .meta import DistKey, SortKey # noqa # py38 or later from importlib.metadata import version, PackageNotFoundError diff --git a/django_redshift_backend/_vendor/django40/db/backends/base/base.py b/django_redshift_backend/_vendor/django40/db/backends/base/base.py index a7f923c..56cf081 100644 --- a/django_redshift_backend/_vendor/django40/db/backends/base/base.py +++ b/django_redshift_backend/_vendor/django40/db/backends/base/base.py @@ -14,9 +14,9 @@ from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import DEFAULT_DB_ALIAS, DatabaseError -from django.db.backends import utils -from django.db.backends.base.validation import BaseDatabaseValidation -from django.db.backends.signals import connection_created +from django_redshift_backend._vendor.django40.db.backends import utils +from django_redshift_backend._vendor.django40.db.backends.base.validation import BaseDatabaseValidation +from django_redshift_backend._vendor.django40.db.backends.signals import connection_created from django.db.transaction import TransactionManagementError from django.db.utils import DatabaseErrorWrapper from django.utils import timezone diff --git a/django_redshift_backend/_vendor/django40/db/backends/base/operations.py b/django_redshift_backend/_vendor/django40/db/backends/base/operations.py index 295c61f..19ac342 100644 --- a/django_redshift_backend/_vendor/django40/db/backends/base/operations.py +++ b/django_redshift_backend/_vendor/django40/db/backends/base/operations.py @@ -6,7 +6,7 @@ from django.conf import settings from django.db import NotSupportedError, transaction -from django.db.backends import utils +from django_redshift_backend._vendor.django40.db.backends import utils from django.utils import timezone from django.utils.encoding import force_str from django.utils.regex_helper import _lazy_re_compile diff --git a/django_redshift_backend/_vendor/django40/db/backends/base/schema.py b/django_redshift_backend/_vendor/django40/db/backends/base/schema.py index fd8211e..083216c 100644 --- a/django_redshift_backend/_vendor/django40/db/backends/base/schema.py +++ b/django_redshift_backend/_vendor/django40/db/backends/base/schema.py @@ -1,7 +1,7 @@ import logging from datetime import datetime -from django.db.backends.ddl_references import ( +from django_redshift_backend._vendor.django40.db.backends.ddl_references import ( Columns, Expressions, ForeignKeyName, @@ -9,7 +9,7 @@ Statement, Table, ) -from django.db.backends.utils import names_digest, split_identifier +from django_redshift_backend._vendor.django40.db.backends.utils import names_digest, split_identifier from django.db.models import Deferrable, Index from django.db.models.sql import Query from django.db.transaction import TransactionManagementError, atomic diff --git a/django_redshift_backend/_vendor/django40/db/backends/postgresql/base.py b/django_redshift_backend/_vendor/django40/db/backends/postgresql/base.py index 92f3932..17d33c7 100644 --- a/django_redshift_backend/_vendor/django40/db/backends/postgresql/base.py +++ b/django_redshift_backend/_vendor/django40/db/backends/postgresql/base.py @@ -13,8 +13,8 @@ from django.core.exceptions import ImproperlyConfigured from django.db import DatabaseError as WrappedDatabaseError from django.db import connections -from django.db.backends.base.base import BaseDatabaseWrapper -from django.db.backends.utils import CursorDebugWrapper as BaseCursorDebugWrapper +from django_redshift_backend._vendor.django40.db.backends.base.base import BaseDatabaseWrapper +from django_redshift_backend._vendor.django40.db.backends.utils import CursorDebugWrapper as BaseCursorDebugWrapper from django.utils.asyncio import async_unsafe from django.utils.functional import cached_property from django.utils.safestring import SafeString diff --git a/django_redshift_backend/_vendor/django40/db/backends/postgresql/client.py b/django_redshift_backend/_vendor/django40/db/backends/postgresql/client.py index 4c9bd63..bf27fa7 100644 --- a/django_redshift_backend/_vendor/django40/db/backends/postgresql/client.py +++ b/django_redshift_backend/_vendor/django40/db/backends/postgresql/client.py @@ -1,6 +1,6 @@ import signal -from django.db.backends.base.client import BaseDatabaseClient +from django_redshift_backend._vendor.django40.db.backends.base.client import BaseDatabaseClient class DatabaseClient(BaseDatabaseClient): diff --git a/django_redshift_backend/_vendor/django40/db/backends/postgresql/creation.py b/django_redshift_backend/_vendor/django40/db/backends/postgresql/creation.py index 70c3eda..79e4514 100644 --- a/django_redshift_backend/_vendor/django40/db/backends/postgresql/creation.py +++ b/django_redshift_backend/_vendor/django40/db/backends/postgresql/creation.py @@ -3,8 +3,8 @@ from psycopg2 import errorcodes from django.core.exceptions import ImproperlyConfigured -from django.db.backends.base.creation import BaseDatabaseCreation -from django.db.backends.utils import strip_quotes +from django_redshift_backend._vendor.django40.db.backends.base.creation import BaseDatabaseCreation +from django_redshift_backend._vendor.django40.db.backends.utils import strip_quotes class DatabaseCreation(BaseDatabaseCreation): diff --git a/django_redshift_backend/_vendor/django40/db/backends/postgresql/features.py b/django_redshift_backend/_vendor/django40/db/backends/postgresql/features.py index 6dab8d7..7a233a6 100644 --- a/django_redshift_backend/_vendor/django40/db/backends/postgresql/features.py +++ b/django_redshift_backend/_vendor/django40/db/backends/postgresql/features.py @@ -1,7 +1,7 @@ import operator from django.db import InterfaceError -from django.db.backends.base.features import BaseDatabaseFeatures +from django_redshift_backend._vendor.django40.db.backends.base.features import BaseDatabaseFeatures from django.utils.functional import cached_property diff --git a/django_redshift_backend/_vendor/django40/db/backends/postgresql/introspection.py b/django_redshift_backend/_vendor/django40/db/backends/postgresql/introspection.py index 6706cc5..8efbc95 100644 --- a/django_redshift_backend/_vendor/django40/db/backends/postgresql/introspection.py +++ b/django_redshift_backend/_vendor/django40/db/backends/postgresql/introspection.py @@ -1,4 +1,4 @@ -from django.db.backends.base.introspection import ( +from django_redshift_backend._vendor.django40.db.backends.base.introspection import ( BaseDatabaseIntrospection, FieldInfo, TableInfo, diff --git a/django_redshift_backend/_vendor/django40/db/backends/postgresql/operations.py b/django_redshift_backend/_vendor/django40/db/backends/postgresql/operations.py index f2d4510..9cbe073 100644 --- a/django_redshift_backend/_vendor/django40/db/backends/postgresql/operations.py +++ b/django_redshift_backend/_vendor/django40/db/backends/postgresql/operations.py @@ -1,8 +1,8 @@ from psycopg2.extras import Inet from django.conf import settings -from django.db.backends.base.operations import BaseDatabaseOperations -from django.db.backends.utils import split_tzname_delta +from django_redshift_backend._vendor.django40.db.backends.base.operations import BaseDatabaseOperations +from django_redshift_backend._vendor.django40.db.backends.utils import split_tzname_delta class DatabaseOperations(BaseDatabaseOperations): diff --git a/django_redshift_backend/_vendor/django40/db/backends/postgresql/schema.py b/django_redshift_backend/_vendor/django40/db/backends/postgresql/schema.py index fc28144..803939d 100644 --- a/django_redshift_backend/_vendor/django40/db/backends/postgresql/schema.py +++ b/django_redshift_backend/_vendor/django40/db/backends/postgresql/schema.py @@ -1,8 +1,8 @@ import psycopg2 -from django.db.backends.base.schema import BaseDatabaseSchemaEditor -from django.db.backends.ddl_references import IndexColumns -from django.db.backends.utils import strip_quotes +from django_redshift_backend._vendor.django40.db.backends.base.schema import BaseDatabaseSchemaEditor +from django_redshift_backend._vendor.django40.db.backends.ddl_references import IndexColumns +from django_redshift_backend._vendor.django40.db.backends.utils import strip_quotes class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): diff --git a/django_redshift_backend/base.py b/django_redshift_backend/base.py index 0f20867..e0ce5e6 100644 --- a/django_redshift_backend/base.py +++ b/django_redshift_backend/base.py @@ -11,7 +11,6 @@ import uuid import logging -import django from django.utils import timezone from django.conf import settings from django.core.exceptions import FieldDoesNotExist @@ -1015,46 +1014,6 @@ def remove_field(self, model, field): ) super().remove_field(model, field) - # backwards compatiblity for django - # refs: https://github.com/django/django/pull/14459/files - def _create_unique_sql( - self, - model, - fields, - name=None, - condition=None, - deferrable=None, - include=None, - opclasses=None, - expressions=None, - ): - if django.VERSION >= (4,): # dj40 support - return super()._create_unique_sql( - model, - fields, - name=name, - condition=condition, - deferrable=deferrable, - include=include, - opclasses=opclasses, - expressions=expressions, - ) - elif django.VERSION >= (3,): # dj32 support - columns = [ - field.column if hasattr(field, "column") else field for field in fields - ] - return super()._create_unique_sql( - model, - columns, - name=name, - condition=condition, - deferrable=deferrable, - include=include, - opclasses=opclasses, - ) - else: # dj22 or earlier are not supported - raise NotImplementedError - redshift_data_types = { "AutoField": "integer identity(1, 1)", diff --git a/django_redshift_backend/distkey.py b/django_redshift_backend/distkey.py index 241409c..e4f576d 100644 --- a/django_redshift_backend/distkey.py +++ b/django_redshift_backend/distkey.py @@ -1,3 +1,3 @@ # flake8: noqa -# for backward compatibility before 3.0.0 +# for backward compatibility before django-redshift-backend-3.0.0 from .meta import DistKey