New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: UUID field support #54
Conversation
Thanks! I'll take a look in this weekend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Memo: This class variable has been introduced at Django-1.8.0 django/django@39d95fb
With django 1.11, 2.0 and 2.1:
https://github.com/django/django/blob/838e432e3e5519c5383d12018e6c78f8ec7833c1/django/db/models/fields/__init__.py#L2317-L2319
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've applied this line at ff5c1cb
# uuid is the last field of TestModel | ||
uuid_insert_value = statements[0][1][-1] | ||
# the Python value for insertion must be a string whose length is 32 | ||
self.assertEqual(type(uuid_insert_value), str) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I'm sorry for my late reply. |
All right, thanks for merging this! :) |
Subject: Fix for the
UUIDField
supportFeature or Bugfix
Purpose
UUIDField
in Redshift.UUIDField
. We should check that the type of the Python argument isstr
(as opposed touuid.UUID
) and its length is 32.Detail
UUIDField
when used in Redshift (should be astr
, i.e. the value ofUUID.hex
)Relates