Skip to content

Commit 6d8d81f

Browse files
committed
made some macros work with athena, and now the deprectead e2e tests work with athena
1 parent f88a31c commit 6d8d81f

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

integration_tests/deprecated_tests/models/schema.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ models:
347347
- name: groups
348348
columns:
349349
- name: group_a
350-
data_type: "{{ 'strIng' if (target.type == 'bigquery' or target.type == 'databricks') else 'CHArACTER varying' if target.type == 'redshift' else 'teXt' }}"
350+
data_type: "{{ 'strIng' if (target.type == 'bigquery' or target.type == 'databricks' or target.type == 'athena') else 'CHArACTER varying' if target.type == 'redshift' else 'teXt' }}"
351351
- name: group_b
352352
data_type: double
353353
- name: group_c
@@ -365,7 +365,7 @@ models:
365365
- name: stats_players
366366
columns:
367367
- name: player
368-
data_type: "{{ 'STRING' if (target.type == 'bigquery' or target.type == 'databricks') else 'character varying' if target.type == 'redshift' else 'TEXT' }}"
368+
data_type: "{{ 'STRING' if (target.type == 'bigquery' or target.type == 'databricks' or target.type == 'athena') else 'character varying' if target.type == 'redshift' else 'TEXT' }}"
369369
- name: goals
370370
data_type: BOOLEAN
371371
- name: coffee_cups_consumed

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' -%}

macros/utils/cross_db_utils/contains.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,16 @@
3030
lower({{ string }}) like lower('%{{ string_to_search }}%') then true
3131
else false end
3232
{%- endif %}
33+
{% endmacro %}
34+
35+
{% macro athena__contains(string, string_to_search, case_sensitive) %}
36+
{%- if case_sensitive %}
37+
case when
38+
{{ string }} like '%{{ string_to_search }}%' then true
39+
else false end
40+
{%- else %}
41+
case when
42+
lower({{ string }}) like lower('%{{ string_to_search }}%') then true
43+
else false end
44+
{%- endif %}
3345
{% endmacro %}

0 commit comments

Comments
 (0)