diff --git a/dbt/include/teradata/macros/materializations/unit/get_fixture_sql.sql b/dbt/include/teradata/macros/materializations/unit/get_fixture_sql.sql index 0bf9e965..120fa24e 100644 --- a/dbt/include/teradata/macros/materializations/unit/get_fixture_sql.sql +++ b/dbt/include/teradata/macros/materializations/unit/get_fixture_sql.sql @@ -3,11 +3,11 @@ -- [Teradata Database] [Error 3888] A SELECT for a UNION,INTERSECT or MINUS must reference a table -- To avoid this error we are are using a workaround [ from SYS_CALENDAR.CALENDAR where day_of_calendar = 1 ] in between those sel statements -{% macro get_expected_sql(rows, column_name_to_data_types) -%} - {{ adapter.dispatch('get_expected_sql', 'dbt')(rows, column_name_to_data_types) }} +{% macro get_expected_sql(rows, column_name_to_data_types, column_name_to_quoted) -%} + {{ adapter.dispatch('get_expected_sql', 'dbt')(rows, column_name_to_data_types, column_name_to_quoted) }} {%- endmacro %} -{% macro teradata__get_expected_sql(rows, column_name_to_data_types) %} +{% macro teradata__get_expected_sql(rows, column_name_to_data_types, column_name_to_quoted) %} {%- if (rows | length) == 0 -%} select * from dbt_internal_unit_test_actual @@ -17,7 +17,7 @@ {%- for row in rows -%} {%- set formatted_row = format_row(row, column_name_to_data_types) -%} select -{%- for column_name, column_value in formatted_row.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%}, {% else %} {{ ' ' }} {%- endif %} +{%- for column_name, column_value in formatted_row.items() %} {{ column_value }} as {{ column_name_to_quoted[column_name] }}{% if not loop.last -%}, {% else %} {{ ' ' }} {%- endif %} {%- endfor %} {%- if not loop.last %} from SYS_CALENDAR.CALENDAR where day_of_calendar = 1 @@ -45,11 +45,12 @@ from SYS_CALENDAR.CALENDAR where day_of_calendar = 1 {%- set columns_in_relation = adapter.get_columns_in_relation(this_or_defer_relation) -%} {%- set column_name_to_data_types = {} -%} - +{%- set column_name_to_quoted = {} -%} {%- for column in columns_in_relation -%} {#-- This needs to be a case-insensitive comparison --#} {%- do column_name_to_data_types.update({column.name|lower: column.data_type}) -%} +{%- do column_name_to_quoted.update({column.name|lower: column.quoted}) -%} {%- endfor -%} {%- endif -%} @@ -66,7 +67,7 @@ from SYS_CALENDAR.CALENDAR where day_of_calendar = 1 {%- set default_row_copy = default_row.copy() -%} {%- do default_row_copy.update(formatted_row) -%} select -{%- for column_name, column_value in default_row_copy.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%}, {% else %} {{ ' ' }} {%- endif %} +{%- for column_name, column_value in default_row_copy.items() %} {{ column_value }} as {{ column_name_to_quoted[column_name] }}{% if not loop.last -%}, {% else %} {{ ' ' }} {%- endif %} {%- endfor %} {%- if not loop.last %} from SYS_CALENDAR.CALENDAR where day_of_calendar = 1 @@ -77,7 +78,7 @@ from SYS_CALENDAR.CALENDAR where day_of_calendar = 1 {%- if (rows | length) == 0 -%} select - {%- for column_name, column_value in default_row.items() %} {{ column_value }} as {{ column_name }}{% if not loop.last -%},{%- endif %} + {%- for column_name, column_value in default_row.items() %} {{ column_value }} as {{ column_name_to_quoted[column_name] }}{% if not loop.last -%},{%- endif %} {%- endfor %} sample 0 {%- endif -%} diff --git a/requirements_dev.txt b/requirements_dev.txt index 6a089760..50e8d8cc 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -8,8 +8,8 @@ pytest~=7.0 tox~=3.2 pylava~=0.3.0 teradatasql>=20.00.00.10 -dbt-adapters>=1.7.2,<2.0 -dbt-common>=1.3.0 +dbt-adapters>=1.17.2 +dbt-common>=1.13,<2.0 MarkupSafe==2.0.1 pytest-dotenv pytest-cov diff --git a/setup.py b/setup.py index bf0f0cda..c75dd24e 100644 --- a/setup.py +++ b/setup.py @@ -48,8 +48,8 @@ ], }, install_requires=[ - "dbt-adapters>=1.7.2", - "dbt-common>=1.3.0", + "dbt-adapters>=1.17.2", + "dbt-common>=1.13,<2.0", "teradatasql>=20.00.00.10", ], classifiers=[