Dear dbt Elementary Team, We are currently using d...
# community-support
b
Dear dbt Elementary Team, We are currently using dbt in conjunction with Snowflake on AWS. Our environment includes a macro called re_generate_schema_name.sql. The macro is defined as follows: The macro is here: {% macro generate_schema_name(custom_schema_name=none, node=none) %} {%- set default_schema = target.schema -%} {%- if target.account == 'my_dev_account' and 'my_service_user' not in target.user -%} {%- set dbt_dev_name = target.user.split("@")[0].replace(".", "") %} {%- if custom_schema_name is none -%} DBT_{{ dbt_dev_name | trim | upper }} {%- else -%} DBT_{{ dbt_dev_name | trim | upper }}_{{ custom_schema_name | trim | upper }} {%- endif -%} {%- else -%} {%- if custom_schema_name is none -%} {{ default_schema | trim | upper }} {%- else -%} {{ custom_schema_name | trim | upper }} {%- endif -%} {%- endif -%} {% endmacro %} Additionally, we have created a GitLab branch and configured the dbt_project.yml file as follows: models: elementary: ## elementary models will be created in the schema '<your_schema>_elementary' +schema: "elementary" When we run dbt using the my_user account, everything works as expected. The my_user_elementary schema is successfully created in Snowflake (note that my_user is different from my_service_user). However, when we check out the dev_master branch and run dbt using the my_service_user account, the elementary schema is not created under the specified schema. Instead, it is created a schema called DEFAULT. All the Elementary tables and views under the DEFAULT schema Could you please assist us in resolving this issue? We appreciate your help in advance. Thank you!
{%- if target.account == 'my_dev_account' and 'my_service_user' not in target.user -%} . If I change my_service_user to my_user account, elementary schema is created in snowflake . If I change back to my_service_user, elementary schedma is not created.
o
Hi @Blair Mo, your latest comment confused me a bit, are the elementary tables created in the wrong place or are they not created at all? also, are all the rest of the models in your project created in the correct places?