Redundant Schema name appearing in target db

The problem I’m having

My dbt core project is appending redundant schema name at run time in the target db in Snowflake

In my profiles.yml, my schema is called ‘ORDER_REPO,’ however at run time, it’s creating an obj named publish.ORDER_REPO_order_repo.test_gold_billed_orders_v, with the schema name injected twice.

@tmdbt
looks like u Have defined the schema for model in yml /model file?

dbt by default creates models in <target_schema>_<custom_schema> to overcome this u have to override the generate_schema_name macro

create a sql file generate_schema_name.sql and add the below code to it then try to run dbt commands to create models in a given schema

{% macro generate_schema_name(custom_schema_name, node) -%}

    {%- set default_schema = target.schema -%}
    {%- if custom_schema_name is none -%}

        {{ default_schema }}

    {%- else -%}

        {{ custom_schema_name | trim }}

    {%- endif -%}

{%- endmacro %}