diff --git a/macros/internal/metadata_processing/escape_column_names.sql b/macros/internal/metadata_processing/escape_column_names.sql index 35501b2c..abe77bd8 100644 --- a/macros/internal/metadata_processing/escape_column_names.sql +++ b/macros/internal/metadata_processing/escape_column_names.sql @@ -192,8 +192,13 @@ {%- set escape_char_left = var('escape_char_left', "") -%} {%- set escape_char_right = var('escape_char_right', "") -%} - {%- set escaped_column_name = escape_char_left ~ column | upper | replace(escape_char_left, '') | replace(escape_char_right, '') | trim ~ escape_char_right | indent(4) -%} + {% set set_casing = var('datavault4dbt.set_casing', none) %} + {% if set_casing|lower in ['upper', 'uppercase'] %} + {%- set escaped_column_name = escape_char_left ~ column | upper | replace(escape_char_left, '') | replace(escape_char_right, '') | trim ~ escape_char_right | indent(4) -%} + {% elif set_casing|lower in ['lower', 'lowercase'] %} + {%- set escaped_column_name = escape_char_left ~ column | lower | replace(escape_char_left, '') | replace(escape_char_right, '') | trim ~ escape_char_right | indent(4) -%} + {% endif %} {%- do return(escaped_column_name) -%} -{%- endmacro -%} \ No newline at end of file +{%- endmacro -%}