Use DPE own type_string

This commit is contained in:
Benoit Perigaud
2024-08-19 19:16:39 +02:00
parent 9bb90312ff
commit 14c3c711be
4 changed files with 9 additions and 13 deletions

View File

@@ -3,13 +3,9 @@
{%- endmacro -%}
{%- macro default__type_string() -%}
{{ return(dbt.type_string()) }}
{%- endmacro -%}
{%- macro redshift__type_string() -%}
{{ return(api.Column.string_type(600)) }}
{%- endmacro -%}
{%- macro bigquery__type_string() -%}
{{ return("STRING") }}
{%- endmacro -%}
{%- macro databricks__type_string() -%}
{{ return("STRING") }}
{%- endmacro -%}

View File

@@ -23,8 +23,8 @@
{%- set values_line =
[
"cast('" ~ node.unique_id ~ "' as " ~ dbt.type_string() ~ ")",
"cast(NULL as " ~ dbt.type_string() ~ ")",
"cast('" ~ node.unique_id ~ "' as " ~ dbt_project_evaluator.type_string() ~ ")",
"cast(NULL as " ~ dbt_project_evaluator.type_string() ~ ")",
"FALSE",
]
%}
@@ -37,8 +37,8 @@
{%- set values_line =
[
"cast('" ~ node.unique_id ~ "' as " ~ dbt.type_string() ~ ")",
"cast('" ~ parent ~ "' as " ~ dbt.type_string() ~ ")",
"cast('" ~ node.unique_id ~ "' as " ~ dbt_project_evaluator.type_string() ~ ")",
"cast('" ~ parent ~ "' as " ~ dbt_project_evaluator.type_string() ~ ")",
"" ~ loop.last ~ "" if node.unique_id.split('.')[0] == 'test' else "FALSE"
]
%}

View File

@@ -1,6 +1,6 @@
{% macro wrap_string_with_quotes(str) %}
{% if str is none %}
{{ return('cast(NULL as ' ~ dbt.type_string() ~ ')') }}
{{ return('cast(NULL as ' ~ dbt_project_evaluator.type_string() ~ ')') }}
{% else %}
{{ dbt.string_literal(str) }}
{% endif %}