From 9e82f58ff01640d2f66e7f027aa3a1021aef3441 Mon Sep 17 00:00:00 2001 From: Robin Norgren <68205730+rjoelnorgren@users.noreply.github.com> Date: Sat, 18 May 2024 09:56:12 -0700 Subject: [PATCH] Omit empty dictionary connection_overrides from materialization DDL --- .../clickhouse/macros/materializations/dictionary.sql | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dbt/include/clickhouse/macros/materializations/dictionary.sql b/dbt/include/clickhouse/macros/materializations/dictionary.sql index ef8e64e5..4d03027e 100644 --- a/dbt/include/clickhouse/macros/materializations/dictionary.sql +++ b/dbt/include/clickhouse/macros/materializations/dictionary.sql @@ -82,16 +82,18 @@ {%- set credentials = adapter.get_credentials(config.get("connection_overrides", {})) -%} {%- set table = config.get('table') -%} CLICKHOUSE( + {% if credentials.get("user") -%} user '{{ credentials.get("user") }}' - {% if credentials.get("password") != '' -%} + {%- endif %} + {% if credentials.get("password") -%} password '{{ credentials.get("password") }}' {%- endif %} - {% if credentials.get("database") != '' -%} + {% if credentials.get("database") -%} db '{{ credentials.get("database") }}' {%- endif %} - {% if credentials.get("host") != '' and credentials.get("host") != 'localhost' -%} + {% if credentials.get("host") and credentials.get("host") != 'localhost' -%} host '{{ credentials.get("host") }}' - {% if credentials.get("port") != '' -%} + {% if credentials.get("port") -%} port '{{ credentials.get("port") }}' {%- endif %} {%- endif %}