From f5152720aca1ab2f985ec09a04c096863a6c1620 Mon Sep 17 00:00:00 2001 From: Takayuki Shimizukawa Date: Tue, 15 Feb 2022 06:16:39 +0900 Subject: [PATCH] adjust nits --- django_redshift_backend/base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/django_redshift_backend/base.py b/django_redshift_backend/base.py index 3b6fc76..6a08ac5 100644 --- a/django_redshift_backend/base.py +++ b/django_redshift_backend/base.py @@ -24,7 +24,6 @@ DatabaseIntrospection as BasePGDatabaseIntrospection, ) from django.db.models import Index - from django.db.utils import NotSupportedError from django_redshift_backend.distkey import DistKey @@ -566,7 +565,6 @@ class DatabaseCreation(BasePGDatabaseCreation): class DatabaseIntrospection(BasePGDatabaseIntrospection): - pass def get_table_description(self, cursor, table_name): """ @@ -579,6 +577,8 @@ def get_table_description(self, cursor, table_name): # This function is based on the version from the Django postgres backend # from before support for collations were introduced in Django 3.2 + # https://github.com/django/django/blob/3.1.14/django/db/backends/ + # postgresql/introspection.py#L66-L94 cursor.execute(""" SELECT a.attname AS column_name, @@ -624,6 +624,8 @@ def get_constraints(self, cursor, table_name): indexes. """ # Based on code from Django 3.2 + # https://github.com/django/django/blob/3.2.12/django/db/backends/ + # postgresql/introspection.py#L148-L182 constraints = {} # Loop over the key table, collecting things as constraints. The column # array must return column names in the same order in which they were @@ -666,6 +668,8 @@ def get_constraints(self, cursor, table_name): # Now get indexes # Based on code from Django 1.7 + # https://github.com/django/django/blob/1.7.11/django/db/backends/ + # postgresql_psycopg2/introspection.py#L182-L207 cursor.execute(""" SELECT c2.relname,