From db636764f5c383771799b088e2c82aa7e02eb237 Mon Sep 17 00:00:00 2001 From: Corentin Dupret Date: Thu, 15 Nov 2018 17:43:54 -0800 Subject: [PATCH 1/4] fix typo in doc --- doc/dev.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/dev.rst b/doc/dev.rst index d6efa55..f5b8f4d 100644 --- a/doc/dev.rst +++ b/doc/dev.rst @@ -20,7 +20,7 @@ Setup development environment * Requires supported Python version * do setup under django-redshift-backend.git repository root as:: - $ pip install -U pip setuptools wheel setuotools_scm + $ pip install -U pip setuptools wheel setuptools_scm $ pip install -r dev-requires.txt Testing From 97eb153cffa8c21fe1e85b47e55ed3215c7b16b2 Mon Sep 17 00:00:00 2001 From: Corentin Dupret Date: Thu, 15 Nov 2018 17:44:35 -0800 Subject: [PATCH 2/4] fix uuid field support --- django_redshift_backend/base.py | 1 + tests/test_redshift_backend.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/django_redshift_backend/base.py b/django_redshift_backend/base.py index 0e8595a..6540269 100644 --- a/django_redshift_backend/base.py +++ b/django_redshift_backend/base.py @@ -36,6 +36,7 @@ class DatabaseFeatures(BasePGDatabaseFeatures): supports_column_check_constraints = False can_distinct_on_fields = False allows_group_by_selected_pks = False + has_native_uuid_field = False class DatabaseOperations(BasePGDatabaseOperations): diff --git a/tests/test_redshift_backend.py b/tests/test_redshift_backend.py index ea475d3..9ab751d 100644 --- a/tests/test_redshift_backend.py +++ b/tests/test_redshift_backend.py @@ -70,6 +70,19 @@ def test_annotate(self): sql = norm_sql(compiler.as_sql()[0]) self.assertEqual(sql, expected_dml_annotate) + def test_insert_uuid_field(self): + import uuid + from django.db.models import sql + from testapp.models import TestModel + obj = TestModel(uuid=uuid.uuid4()) + q = sql.InsertQuery(obj) + q.insert_values(obj._meta.local_fields, [obj]) + statements = q.get_compiler('default').as_sql() + # uuid is the last field of TestModel + uuid_insert_value = statements[0][1][-1] + # the Python value for insertion must be a string of length 32 + self.assertEqual(type(uuid_insert_value), str) + self.assertEqual(len(uuid_insert_value), 32) class MigrationTest(unittest.TestCase): From 29c52175fa17e6950ca85617e2bda57100adaddc Mon Sep 17 00:00:00 2001 From: Corentin Dupret Date: Thu, 15 Nov 2018 18:00:08 -0800 Subject: [PATCH 3/4] fix comment --- tests/test_redshift_backend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_redshift_backend.py b/tests/test_redshift_backend.py index 9ab751d..88db72d 100644 --- a/tests/test_redshift_backend.py +++ b/tests/test_redshift_backend.py @@ -80,7 +80,7 @@ def test_insert_uuid_field(self): statements = q.get_compiler('default').as_sql() # uuid is the last field of TestModel uuid_insert_value = statements[0][1][-1] - # the Python value for insertion must be a string of length 32 + # the Python value for insertion must be a string whose length is 32 self.assertEqual(type(uuid_insert_value), str) self.assertEqual(len(uuid_insert_value), 32) From 700983fb329bde48c8c3520afc3d6b1321b44f25 Mon Sep 17 00:00:00 2001 From: Corentin Dupret Date: Thu, 15 Nov 2018 18:07:24 -0800 Subject: [PATCH 4/4] fix flake8 CI --- tests/test_redshift_backend.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_redshift_backend.py b/tests/test_redshift_backend.py index 88db72d..1410a81 100644 --- a/tests/test_redshift_backend.py +++ b/tests/test_redshift_backend.py @@ -84,6 +84,7 @@ def test_insert_uuid_field(self): self.assertEqual(type(uuid_insert_value), str) self.assertEqual(len(uuid_insert_value), 32) + class MigrationTest(unittest.TestCase): def check_model_creation(self, model, expected_ddl):