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 97159b66..50bc853d 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 @@ -17,9 +17,15 @@ limitations under the License.*/ else target.root_path -%} {%- set custom_schema_name = custom_schema_name if not is_datalake_node(node) else node.config.root_path -%} + {%- set custom_schema_name = append_schema(custom_schema_name or default_schema, node.config.schema) + if node.config.materialized == 'table' else custom_schema_name -%} {{ generate_schema_name_impl(default_schema, custom_schema_name, node) }} {%- endmacro %} +{% macro append_schema(base_path, subfolder) -%} + {{ base_path if subfolder is none else subfolder if base_path in [none, 'no_schema'] else base_path ~ '.' ~ subfolder }} +{%- endmacro %} + {% macro generate_schema_name_impl(default_schema, custom_schema_name=none, node=none) -%} {%- if custom_schema_name is none -%}