From b12db5e9c5af5b16927da77ebfda09aee6021bfc Mon Sep 17 00:00:00 2001 From: Michelle Ark Date: Tue, 22 Oct 2024 15:45:13 -0400 Subject: [PATCH] TestSourceQuotingLegacy --- .../relation_quoting/test_relation_quoting.py | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/functional/relation_quoting/test_relation_quoting.py diff --git a/tests/functional/relation_quoting/test_relation_quoting.py b/tests/functional/relation_quoting/test_relation_quoting.py new file mode 100644 index 00000000000..10817c2222f --- /dev/null +++ b/tests/functional/relation_quoting/test_relation_quoting.py @@ -0,0 +1,37 @@ +import pytest + +from dbt.tests.util import read_file, run_dbt + +_SOURCES_YML = """ +sources: + - name: source_name + database: source_database + schema: source_schema + tables: + - name: customers +""" + + +class TestSourceQuotingLegacy: + @pytest.fixture(scope="class") + def project_config_update(self): + return { + "quoting": { + "database": True, + "schema": True, + "database": True, + }, + } + + @pytest.fixture(scope="class") + def models(self): + return { + "sources.yml": _SOURCES_YML, + "model.sql": "select * from {{ source('source_name', 'customers') }}", + } + + def test_sources_ignore_global_quoting_configs(self, project): + run_dbt(["compile"]) + + generated_sql = read_file("target", "compiled", "test", "models", "model.sql") + assert generated_sql == "select * from source_database.source_schema.customers"