From 5ecf3e53a374bc4207eb66266d84af6018db9c4c Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Wed, 31 Jan 2024 21:27:52 -0500 Subject: [PATCH] Fix crash in DatabaseIntrospection.get_table_description() due to Snowflake's DESCRIBE TABLE change. The "privacy domain" column is new. --- CHANGELOG.md | 5 +++++ django_snowflake/features.py | 2 +- django_snowflake/introspection.py | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da03896..3c3ace0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 5.0.1 - Unreleased + +* Fixed crash in `DatabaseIntrospection.get_table_description()` due to + Snowflake adding a column to the output of `DESCRIBE TABLE`. + ## 5.0 - 2023-12-16 Initial release for Django 5.0.x. diff --git a/django_snowflake/features.py b/django_snowflake/features.py index bc3ab48..a3dacaa 100644 --- a/django_snowflake/features.py +++ b/django_snowflake/features.py @@ -415,7 +415,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): 'migrations.test_operations.OperationTests.test_alter_field_add_database_default', 'migrations.test_operations.OperationTests.test_alter_field_change_default_to_database_default', 'migrations.test_operations.OperationTests.test_alter_field_change_nullable_to_database_default_not_null', - 'migrations.test_operations.OperationTests.test_alter_field_change_nullable_to_decimal_database_default_not_null', + 'migrations.test_operations.OperationTests.test_alter_field_change_nullable_to_decimal_database_default_not_null', # noqa }, "Snowflake: Invalid column default expression [PI()].": { 'migrations.test_operations.OperationTests.test_add_field_database_default_function', diff --git a/django_snowflake/introspection.py b/django_snowflake/introspection.py index 6ff6120..36dff42 100644 --- a/django_snowflake/introspection.py +++ b/django_snowflake/introspection.py @@ -166,7 +166,9 @@ def get_table_description(self, cursor, table_name): ) for ( name, data_type, kind, null, default, pk, unique_key, check, - expression, comment, policy_name, + # *_ ignores policy_name, privacy_domain, and any future + # columns in DESCRIBE TABLE output. + expression, comment, *_ ) in table_info ]