Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upper/Lower Case support for Databricks column names #293

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions macros/internal/metadata_processing/escape_column_names.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%}
{%- endmacro -%}