From ad605f8a72c279ac1c6b22291fb0fc81298dba08 Mon Sep 17 00:00:00 2001 From: Liliana Zheng Date: Wed, 19 Nov 2025 15:56:14 +0000 Subject: [PATCH 1/8] Reenable root_path config again, behaving like schema config --- dbt/include/dremio/macros/get_custom_name/get_custom_schema.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbt/include/dremio/macros/get_custom_name/get_custom_schema.sql b/dbt/include/dremio/macros/get_custom_name/get_custom_schema.sql index 67d8ba94..0479afe9 100644 --- a/dbt/include/dremio/macros/get_custom_name/get_custom_schema.sql +++ b/dbt/include/dremio/macros/get_custom_name/get_custom_schema.sql @@ -15,6 +15,8 @@ limitations under the License.*/ {% macro dremio__generate_schema_name(custom_schema_name, node) -%} {%- set default_schema = target.schema if not is_datalake_node(node) else target.root_path -%} + {%- set custom_schema_name = custom_schema_name if not is_datalake_node(node) + else node.config.root_path -%} {{ generate_schema_name_impl(default_schema, custom_schema_name, node) }} {%- endmacro %} From cf3c30e9f196f71e223f16e98c5e5e2a0bea4e6e Mon Sep 17 00:00:00 2001 From: Liliana Zheng Date: Wed, 19 Nov 2025 19:39:25 +0000 Subject: [PATCH 2/8] Fix relation representation string to display dremio_space as well in the logs --- dbt/adapters/dremio/relation.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dbt/adapters/dremio/relation.py b/dbt/adapters/dremio/relation.py index 6ab98733..d5c0d5a4 100644 --- a/dbt/adapters/dremio/relation.py +++ b/dbt/adapters/dremio/relation.py @@ -126,3 +126,22 @@ def _render_event_time_filtered(self, event_time_filter: EventTimeFilter) -> str filter = f"{event_time_filter.field_name} < '{end_ts}'" return filter + + def __str__(self) -> str: + """ + Override string representation to show the full Dremio path in logs. + This ensures database.schema.identifier is displayed correctly. + """ + # Build the path components without quotes for logging + parts = [] + + if self.database: + parts.append(self.database) + + if self.schema and self.schema != self.no_schema: + parts.append(self.schema) + + if self.identifier: + parts.append(self.identifier) + + return ".".join(parts) From 6c25fe5fd3c7f062a7635e44706d7e96d3ab89ca Mon Sep 17 00:00:00 2001 From: Liliana Zheng Date: Wed, 19 Nov 2025 19:39:47 +0000 Subject: [PATCH 3/8] Alias typo fix --- dbt/include/dremio/profile_template.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbt/include/dremio/profile_template.yml b/dbt/include/dremio/profile_template.yml index e13eedb2..5f297e27 100644 --- a/dbt/include/dremio/profile_template.yml +++ b/dbt/include/dremio/profile_template.yml @@ -66,13 +66,13 @@ prompts: hint: 'object storage source for seeds, tables, etc. [dbt alias: datalake]' object_storage_path: default: 'no_schema' - hint: 'object storage path [dbt alias: schema]' + hint: 'object storage path [dbt alias: root_path]' dremio_space: default: '@user' hint: 'space for creating views [dbt alias: database]' dremio_space_folder: default: 'no_schema' - hint: 'dremio space folder [dbt alias: root_path]' + hint: 'dremio space folder [dbt alias: schema]' threads: hint: '1 or more' type: 'int' From 1dc5da3e9bae6e6f62f0e0b7872566f5eec11bb3 Mon Sep 17 00:00:00 2001 From: Liliana Zheng Date: Sun, 23 Nov 2025 22:19:00 +0000 Subject: [PATCH 4/8] Adapt nested schema tests --- .../dremio_specific/test_nested_schema.py | 293 ++++++++++++++---- 1 file changed, 240 insertions(+), 53 deletions(-) diff --git a/tests/functional/adapter/dremio_specific/test_nested_schema.py b/tests/functional/adapter/dremio_specific/test_nested_schema.py index c32b5edf..696c4f70 100644 --- a/tests/functional/adapter/dremio_specific/test_nested_schema.py +++ b/tests/functional/adapter/dremio_specific/test_nested_schema.py @@ -1,8 +1,9 @@ import pytest from dbt.tests.util import run_dbt, get_connection -from tests.utils.util import relation_from_name +from tests.fixtures.profiles import unique_schema, dbt_profile_data +# Table tests - should use root_path config custom_schema_table_no_schema_model = """ {{ config( materialized='table' @@ -10,22 +11,31 @@ select 1 as id """ -custom_schema_table_model = """ +custom_schema_table_with_root_path_model = """ {{ config( materialized='table', - schema='schema' + root_path='schema' ) }} select 1 as id """ -custom_schema_table_nested_model = """ +custom_schema_table_with_schema_config_model = """ {{ config( materialized='table', - schema='nested.schema' + schema='useless_config' +) }} +select 1 as id +""" + +custom_schema_table_nested_with_root_path_model = """ +{{ config( + materialized='table', + root_path='nested.schema' ) }} select 1 as id """ +# View tests - should use schema config custom_schema_view_no_schema_model = """ {{ config( materialized='view' @@ -33,7 +43,7 @@ select 1 as id """ -custom_schema_view_model = """ +custom_schema_view_with_schema_config_model = """ {{ config( materialized='view', schema='schema' @@ -41,7 +51,15 @@ select 1 as id """ -custom_schema_view_nested_model = """ +custom_schema_view_with_root_path_config_model = """ +{{ config( + materialized='view', + root_path='useless_config' +) }} +select 1 as id +""" + +custom_schema_view_nested_with_schema_config_model = """ {{ config( materialized='view', schema='nested.schema' @@ -54,64 +72,233 @@ class TestGetCustomSchema: @pytest.fixture(scope="class") def models(self): return { + # Table models "custom_schema_table_no_schema.sql": custom_schema_table_no_schema_model, - "custom_schema_table.sql": custom_schema_table_model, - "custom_schema_table_nested.sql": custom_schema_table_nested_model, + "custom_schema_table_with_root_path.sql": custom_schema_table_with_root_path_model, + "custom_schema_table_with_schema_config.sql": custom_schema_table_with_schema_config_model, + "custom_schema_table_nested_with_root_path.sql": custom_schema_table_nested_with_root_path_model, + # View models "custom_schema_view_no_schema.sql": custom_schema_view_no_schema_model, - "custom_schema_view.sql": custom_schema_view_model, - "custom_schema_view_nested.sql": custom_schema_view_nested_model, + "custom_schema_view_with_schema_config.sql": custom_schema_view_with_schema_config_model, + "custom_schema_view_with_root_path_config.sql": custom_schema_view_with_root_path_config_model, + "custom_schema_view_nested_with_schema_config.sql": custom_schema_view_nested_with_schema_config_model, } + # ===== TABLE TESTS ===== + def test_custom_schema_table_no_schema(self, project): + """Test table without custom schema - should use default root_path from profile""" run_dbt(["run", "--select", "custom_schema_table_no_schema"]) - table_relation = relation_from_name( - project.adapter, "custom_schema_table_no_schema") + + # Expected path components + credentials = project.adapter.config.credentials + expected_database = credentials.datalake + expected_schema = credentials.root_path # e.g., "dbtdremios3.test17636798006768308215_test_nested_schema" + expected_identifier = "custom_schema_table_no_schema" + + # Get the actual relation from Dremio + with get_connection(project.adapter): + actual_relation = project.adapter.get_relation( + database=expected_database, + schema=expected_schema, + identifier=expected_identifier + ) + + # Verify the relation was created with the expected path + assert actual_relation is not None, f"Table should have been created at {expected_database}.{expected_schema}.{expected_identifier}" + assert actual_relation.type == "table" + + columns = project.adapter.get_columns_in_relation(actual_relation) + assert len(columns) == 1 + assert columns[0].name == "id" + + def test_custom_schema_table_with_root_path(self, project): + """Test table with root_path config - should be appended to default root_path""" + run_dbt(["run", "--select", "custom_schema_table_with_root_path"]) + + # Expected path components + credentials = project.adapter.config.credentials + expected_database = credentials.datalake + expected_schema = f"{credentials.root_path}.schema" + expected_identifier = "custom_schema_table_with_root_path" + + # Get the actual relation from Dremio with get_connection(project.adapter): - columns = project.adapter.get_columns_in_relation(table_relation) - assert len(columns) == 1 - assert columns[0].name == "id" - - def test_custom_schema_table(self, project): - run_dbt(["run", "--select", "custom_schema_table"]) - table_relation = relation_from_name( - project.adapter, "schema.custom_schema_table") + actual_relation = project.adapter.get_relation( + database=expected_database, + schema=expected_schema, + identifier=expected_identifier + ) + + # Verify the relation was created with the expected path + assert actual_relation is not None, f"Table should have been created at {expected_database}.{expected_schema}.{expected_identifier}" + assert actual_relation.type == "table" + + # Verify we can query it + columns = project.adapter.get_columns_in_relation(actual_relation) + assert len(columns) == 1 + assert columns[0].name == "id" + + def test_custom_schema_table_with_schema_config(self, project): + """Test table with schema config - should be IGNORED for tables (root_path is used instead)""" + run_dbt(["run", "--select", "custom_schema_table_with_schema_config"]) + + # Expected path components + credentials = project.adapter.config.credentials + expected_database = credentials.datalake + expected_schema = credentials.root_path # schema config is ignored for tables + expected_identifier = "custom_schema_table_with_schema_config" + + # Get the actual relation from Dremio with get_connection(project.adapter): - columns = project.adapter.get_columns_in_relation(table_relation) - assert len(columns) == 1 - assert columns[0].name == "id" - - def test_custom_schema_table_nested(self, project): - run_dbt(["run", "--select", "custom_schema_table_nested"]) - table_relation = relation_from_name( - project.adapter, "nested.schema.custom_schema_table_nested") + actual_relation = project.adapter.get_relation( + database=expected_database, + schema=expected_schema, + identifier=expected_identifier + ) + + # Verify the relation was created with the expected path + assert actual_relation is not None, f"Table should have been created at {expected_database}.{expected_schema}.{expected_identifier}" + assert actual_relation.type == "table" + + # Verify we can query it + columns = project.adapter.get_columns_in_relation(actual_relation) + assert len(columns) == 1 + assert columns[0].name == "id" + + def test_custom_schema_table_nested_with_root_path(self, project): + """Test table with nested root_path config - should be appended to default root_path""" + run_dbt(["run", "--select", "custom_schema_table_nested_with_root_path"]) + + # Expected path components + credentials = project.adapter.config.credentials + expected_database = credentials.datalake + expected_schema = f"{credentials.root_path}.nested.schema" + expected_identifier = "custom_schema_table_nested_with_root_path" + + # Get the actual relation from Dremio with get_connection(project.adapter): - columns = project.adapter.get_columns_in_relation(table_relation) - assert len(columns) == 1 - assert columns[0].name == "id" + actual_relation = project.adapter.get_relation( + database=expected_database, + schema=expected_schema, + identifier=expected_identifier + ) + + # Verify the relation was created with the expected path + assert actual_relation is not None, f"Table should have been created at {expected_database}.{expected_schema}.{expected_identifier}" + assert actual_relation.type == "table" + + # Verify we can query it + columns = project.adapter.get_columns_in_relation(actual_relation) + assert len(columns) == 1 + assert columns[0].name == "id" + + # ===== VIEW TESTS ===== def test_custom_schema_view_no_schema(self, project): + """Test view without custom schema - should use default schema from profile""" run_dbt(["run", "--select", "custom_schema_view_no_schema"]) - view_relation = relation_from_name( - project.adapter, "custom_schema_view_no_schema") + + # Expected path components + credentials = project.adapter.config.credentials + expected_database = credentials.database + expected_schema = credentials.schema # e.g., "test17636798006768308215_test_nested_schema" + expected_identifier = "custom_schema_view_no_schema" + + # Get the actual relation from Dremio + with get_connection(project.adapter): + actual_relation = project.adapter.get_relation( + database=expected_database, + schema=expected_schema, + identifier=expected_identifier + ) + + # Verify the relation was created with the expected path + assert actual_relation is not None, f"View should have been created at {expected_database}.{expected_schema}.{expected_identifier}" + assert actual_relation.type == "view" + + # Verify we can query it + columns = project.adapter.get_columns_in_relation(actual_relation) + assert len(columns) == 1 + assert columns[0].name == "id" + + def test_custom_schema_view_with_schema_config(self, project): + """Test view with schema config - should be appended to default schema""" + run_dbt(["run", "--select", "custom_schema_view_with_schema_config"]) + + # Expected path components + credentials = project.adapter.config.credentials + expected_database = credentials.database + expected_schema = f"{credentials.schema}.schema" # Appended! + expected_identifier = "custom_schema_view_with_schema_config" + + # Get the actual relation from Dremio with get_connection(project.adapter): - columns = project.adapter.get_columns_in_relation(view_relation) - assert len(columns) == 1 - assert columns[0].name == "id" - - def test_custom_schema_view(self, project): - run_dbt(["run", "--select", "custom_schema_view"]) - view_relation = relation_from_name( - project.adapter, "schema.custom_schema_view") + actual_relation = project.adapter.get_relation( + database=expected_database, + schema=expected_schema, + identifier=expected_identifier + ) + + # Verify the relation was created with the expected path + assert actual_relation is not None, f"View should have been created at {expected_database}.{expected_schema}.{expected_identifier}" + assert actual_relation.type == "view" + + # Verify we can query it + columns = project.adapter.get_columns_in_relation(actual_relation) + assert len(columns) == 1 + assert columns[0].name == "id" + + def test_custom_schema_view_with_root_path_config(self, project): + """Test view with root_path config - should be IGNORED for views (schema is used instead)""" + run_dbt(["run", "--select", "custom_schema_view_with_root_path_config"]) + + # Expected path components - root_path config should be ignored for views + credentials = project.adapter.config.credentials + expected_database = credentials.database + expected_schema = credentials.schema # root_path config is ignored for tables + expected_identifier = "custom_schema_view_with_root_path_config" + + # Get the actual relation from Dremio with get_connection(project.adapter): - columns = project.adapter.get_columns_in_relation(view_relation) - assert len(columns) == 1 - assert columns[0].name == "id" - - def test_custom_schema_view_nested(self, project): - run_dbt(["run", "--select", "custom_schema_view_nested"]) - view_relation = relation_from_name( - project.adapter, "nested.schema.custom_schema_view_nested") + actual_relation = project.adapter.get_relation( + database=expected_database, + schema=expected_schema, + identifier=expected_identifier + ) + + # Verify the relation was created with the expected path (root_path config ignored) + assert actual_relation is not None, f"View should have been created at {expected_database}.{expected_schema}.{expected_identifier} (root_path config should be ignored for views)" + assert actual_relation.type == "view" + + # Verify we can query it + columns = project.adapter.get_columns_in_relation(actual_relation) + assert len(columns) == 1 + assert columns[0].name == "id" + + def test_custom_schema_view_nested_with_schema_config(self, project): + """Test view with nested schema config - should be appended to default schema""" + run_dbt(["run", "--select", "custom_schema_view_nested_with_schema_config"]) + + # Expected path components + credentials = project.adapter.config.credentials + expected_database = credentials.database + expected_schema = f"{credentials.schema}.nested.schema" # Appended! + expected_identifier = "custom_schema_view_nested_with_schema_config" + + # Get the actual relation from Dremio with get_connection(project.adapter): - columns = project.adapter.get_columns_in_relation(view_relation) - assert len(columns) == 1 - assert columns[0].name == "id" + actual_relation = project.adapter.get_relation( + database=expected_database, + schema=expected_schema, + identifier=expected_identifier + ) + + # Verify the relation was created with the expected path + assert actual_relation is not None, f"View should have been created at {expected_database}.{expected_schema}.{expected_identifier}" + assert actual_relation.type == "view" + + # Verify we can query it + columns = project.adapter.get_columns_in_relation(actual_relation) + assert len(columns) == 1 + assert columns[0].name == "id" From d651dac015e3fa3c992ed0a5263dca4161ff669f Mon Sep 17 00:00:00 2001 From: Liliana Zheng Date: Mon, 24 Nov 2025 00:07:52 +0000 Subject: [PATCH 5/8] Fix config --- .../functional/adapter/dremio_specific/test_exact_search.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/functional/adapter/dremio_specific/test_exact_search.py b/tests/functional/adapter/dremio_specific/test_exact_search.py index 8c2ca6d2..82200e93 100644 --- a/tests/functional/adapter/dremio_specific/test_exact_search.py +++ b/tests/functional/adapter/dremio_specific/test_exact_search.py @@ -2,6 +2,7 @@ from dbt.tests.util import run_dbt, get_connection from tests.utils.util import relation_from_name +from tests.fixtures.profiles import unique_schema, dbt_profile_data class TestExactSearchEnabled: @@ -12,7 +13,7 @@ def models(self): "create_table.sql": """ {{ config( materialized='table', - schema='schema') }} + root_path='schema') }} select 1 as ilike """ } @@ -117,4 +118,4 @@ def test_ilike_case_sensitive_list_relations_without_caching(self, project): with get_connection(adapter): columns = adapter.list_relations_without_caching(table_relation) - assert len(columns) == 1 \ No newline at end of file + assert len(columns) == 1 From 8fa148f82475b5bf03e6056e22176b2606542de1 Mon Sep 17 00:00:00 2001 From: Liliana Zheng Date: Mon, 24 Nov 2025 00:36:30 +0000 Subject: [PATCH 6/8] Revert "Fix relation representation string to display dremio_space as well in the logs" This reverts commit cf3c30e9f196f71e223f16e98c5e5e2a0bea4e6e. --- dbt/adapters/dremio/relation.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/dbt/adapters/dremio/relation.py b/dbt/adapters/dremio/relation.py index d5c0d5a4..6ab98733 100644 --- a/dbt/adapters/dremio/relation.py +++ b/dbt/adapters/dremio/relation.py @@ -126,22 +126,3 @@ def _render_event_time_filtered(self, event_time_filter: EventTimeFilter) -> str filter = f"{event_time_filter.field_name} < '{end_ts}'" return filter - - def __str__(self) -> str: - """ - Override string representation to show the full Dremio path in logs. - This ensures database.schema.identifier is displayed correctly. - """ - # Build the path components without quotes for logging - parts = [] - - if self.database: - parts.append(self.database) - - if self.schema and self.schema != self.no_schema: - parts.append(self.schema) - - if self.identifier: - parts.append(self.identifier) - - return ".".join(parts) From 33da662a3a493170a84715563a037f7dbc5041f0 Mon Sep 17 00:00:00 2001 From: Liliana Zheng Date: Wed, 26 Nov 2025 16:06:45 +0000 Subject: [PATCH 7/8] Add changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3583cc9..8ca1d4b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# dbt-dremio v1.10.1 + +## Changes + +- Reenabled `object_storage_path` and `root_path` as config parameters. + # dbt-dremio v1.10.0 ## Changes From 5eaa0f4dc933d93e54623b03218eff2de13c1d74 Mon Sep 17 00:00:00 2001 From: Liliana Zheng Date: Thu, 27 Nov 2025 13:18:18 +0000 Subject: [PATCH 8/8] Fix typo in test_nested_schema Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- tests/functional/adapter/dremio_specific/test_nested_schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/adapter/dremio_specific/test_nested_schema.py b/tests/functional/adapter/dremio_specific/test_nested_schema.py index 696c4f70..778eed95 100644 --- a/tests/functional/adapter/dremio_specific/test_nested_schema.py +++ b/tests/functional/adapter/dremio_specific/test_nested_schema.py @@ -256,7 +256,7 @@ def test_custom_schema_view_with_root_path_config(self, project): # Expected path components - root_path config should be ignored for views credentials = project.adapter.config.credentials expected_database = credentials.database - expected_schema = credentials.schema # root_path config is ignored for tables + expected_schema = credentials.schema # root_path config is ignored for views expected_identifier = "custom_schema_view_with_root_path_config" # Get the actual relation from Dremio