Skip to content

Commit

Permalink
Fix Decimal database defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
timgraham committed Nov 3, 2023
1 parent 9cd5fa9 commit f63df9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions django_snowflake/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class DatabaseFeatures(BaseDatabaseFeatures):
has_json_object_function = False
indexes_foreign_keys = False
nulls_order_largest = True
# At least for DecimalField, Snowflake errors with "Default value data type
# does not match data type for column" if the default isn't serialized.
requires_literal_defaults = True
supported_explain_formats = {'JSON', 'TABULAR', 'TEXT'}
supports_comments = True
supports_comments_inline = True
Expand Down
3 changes: 3 additions & 0 deletions django_snowflake/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ def quote_value(self, value):
else:
return str(value)

def prepare_default(self, value):
return self.quote_value(value)

def skip_default_on_alter(self, field):
# Snowflake: Unsupported feature 'Alter Column Set Default'.
return True

0 comments on commit f63df9b

Please sign in to comment.