diff --git a/dbt/include/spark/macros/adapters.sql b/dbt/include/spark/macros/adapters.sql index bf9f63cf9..5d5989435 100644 --- a/dbt/include/spark/macros/adapters.sql +++ b/dbt/include/spark/macros/adapters.sql @@ -138,7 +138,7 @@ {#-- We can't use temporary tables with `create ... as ()` syntax --#} {% macro spark__create_temporary_view(relation, compiled_code) -%} - create or replace temporary view {{ relation }} as + create or replace temporary view {{ relation.identifier }} as {{ compiled_code }} {%- endmacro -%} @@ -387,6 +387,10 @@ "identifier": tmp_identifier }) -%} + {#-- for SQL model we will create temp view that doesn't have database and schema --#} + {%- if language == 'sql'-%} + {%- set tmp_relation = tmp_relation.include(database=false, schema=false) -%} + {%- endif -%} {% do return(tmp_relation) %} {% endmacro %} diff --git a/tests/functional/adapter/unit_testing/test_unit_testing.py b/tests/functional/adapter/unit_testing/test_unit_testing.py new file mode 100644 index 000000000..998f34b31 --- /dev/null +++ b/tests/functional/adapter/unit_testing/test_unit_testing.py @@ -0,0 +1,10 @@ +from dbt.tests.adapter.unit_testing.test_case_insensitivity import BaseUnitTestCaseInsensivity +from dbt.tests.adapter.unit_testing.test_invalid_input import BaseUnitTestInvalidInput + + +class TestSparkUnitTestCaseInsensitivity(BaseUnitTestCaseInsensivity): + pass + + +class TestSparkUnitTestInvalidInput(BaseUnitTestInvalidInput): + pass