From 2974ce484417759067f1630f43d3d22ad59bea34 Mon Sep 17 00:00:00 2001 From: OscarAdserballe Date: Mon, 5 Aug 2024 15:01:14 +0200 Subject: [PATCH] control flow expression made more concise --- macros/materializations/model.sql | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/macros/materializations/model.sql b/macros/materializations/model.sql index eeff7b7..00858c6 100644 --- a/macros/materializations/model.sql +++ b/macros/materializations/model.sql @@ -54,19 +54,13 @@ {%- set ml_config = config.get('ml_config', {}) -%} {%- set raw_labels = config.get('labels', {}) -%} {%- set sql_header = config.get('sql_header', none) -%} - {%- set has_sql = true -%} - - {%- if ml_config.get('MODEL_TYPE', ml_config.get('model_type', '')).lower() == 'tensorflow' -%} - {%- set has_sql = false -%} - {%- endif -%} - + {{ sql_header if sql_header is not none }} create or replace model {{ relation }} {% if ml_config.get("connection_name") %} remote with connection `{{ ml_config.pop("connection_name") }}` - {% set has_sql = false %} {% endif %} {{ dbt_ml.model_options( @@ -74,7 +68,7 @@ labels=raw_labels ) }} - {%- if has_sql -%} + {%- if sql -%} as ( {{ sql }} );