Skip to content

Commit

Permalink
control flow expression made more concise
Browse files Browse the repository at this point in the history
  • Loading branch information
OscarAdserballe committed Aug 5, 2024
1 parent 921adf5 commit 2974ce4
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions macros/materializations/model.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,21 @@
{%- 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(
ml_config=ml_config,
labels=raw_labels
) }}

{%- if has_sql -%}
{%- if sql -%}
as (
{{ sql }}
);
Expand Down

0 comments on commit 2974ce4

Please sign in to comment.