Skip to content

Commit ea51c79

Browse files
committed
added athena__full_name_split macro because in athena the first index of an array is 0
1 parent 4daf9d5 commit ea51c79

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

macros/edr/system/system_utils/full_names.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,19 @@
6060
trim(split_part(full_table_name,'.',{{ part_index }}),'"') as {{ part_name }}
6161
{% endmacro %}
6262

63+
{% macro athena__full_name_split(part_name) %}
64+
{%- if part_name == 'database_name' -%}
65+
{%- set part_index = 1 -%}
66+
{%- elif part_name == 'schema_name' -%}
67+
{%- set part_index = 2 -%}
68+
{%- elif part_name == 'table_name' -%}
69+
{%- set part_index = 3 -%}
70+
{%- else -%}
71+
{{ return('') }}
72+
{%- endif -%}
73+
trim(split_part(full_table_name,'.',{{ part_index }}),'"') as {{ part_name }}
74+
{% endmacro %}
75+
6376

6477
{% macro databricks__full_name_split(part_name) %}
6578
{%- if part_name == 'database_name' -%}

0 commit comments

Comments
 (0)