From 2fe6fda1fc5dce6e41bd759472e3bf3d7746ecf4 Mon Sep 17 00:00:00 2001 From: rodrigodelmonte Date: Fri, 3 Apr 2020 23:15:32 +0200 Subject: [PATCH] Change redshift diststyle behavior (#2246) * Don't provide a diststyle to redshift tables when configured as "auto" --- CHANGELOG.md | 1 + plugins/redshift/dbt/include/redshift/macros/adapters.sql | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 989b8961221..2eac11968d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - When a macro is called with invalid arguments, include the calling model in the output ([#2073](https://github.com/fishtown-analytics/dbt/issues/2073), [#2238](https://github.com/fishtown-analytics/dbt/pull/2238)) - When a warn exception is not in a jinja do block, return an empty string instead of None ([#2222](https://github.com/fishtown-analytics/dbt/issues/2222), [#2259](https://github.com/fishtown-analytics/dbt/pull/2259)) - Add dbt plugin versions to --version([#2272](https://github.com/fishtown-analytics/dbt/issues/2272), [#2279](https://github.com/fishtown-analytics/dbt/pull/2279)) +- When a Redshift table is defined as "auto", don't provide diststyle ([#2246](https://github.com/fishtown-analytics/dbt/issues/2246), [#2298](https://github.com/fishtown-analytics/dbt/pull/2298)) Contributors: - [@raalsky](https://github.com/Raalsky) ([#2224](https://github.com/fishtown-analytics/dbt/pull/2224), [#2228](https://github.com/fishtown-analytics/dbt/pull/2228)) diff --git a/plugins/redshift/dbt/include/redshift/macros/adapters.sql b/plugins/redshift/dbt/include/redshift/macros/adapters.sql index ea9ec5da21b..eef21c7e46c 100644 --- a/plugins/redshift/dbt/include/redshift/macros/adapters.sql +++ b/plugins/redshift/dbt/include/redshift/macros/adapters.sql @@ -3,8 +3,9 @@ {%- if dist is not none -%} {%- set dist = dist.strip().lower() -%} - {%- if dist in ['all', 'even', 'auto'] -%} + {%- if dist in ['all', 'even'] -%} diststyle {{ dist }} + {%- elif dist == "auto" -%} {%- else -%} diststyle key distkey ({{ dist }}) {%- endif -%}