Skip to content

[Core] "Customize Schema Alias" has broken macro #7912

@jobegrabber

Description

@jobegrabber

Link to the page(s) on docs.getdbt.com requiring updates

https://docs.getdbt.com/guides/customize-schema-alias?step=5

Tell us more about this update

On this page of the guide "Customize dbt models database, schema, and alias" there is a macro code listed that should enforce the usage of custom schemas.

However, I cannot successfully execute dbt build when I configure the custom schema inside a model config in a properties.yml file within a model's directory.
From logging the input to the macro, it seems dbt evaluates the model twice; first without a custom schema, and only then with the custom schema set from the properties file.

If I specify the custom schema either in dbt_project.yml or inside the model's definition (.sql file), the custom schema is set in every call to the macro:

Works:

# dbt_project.yml
models:
  +schema: custom

Works:

# models/model.sql
{{ config(schema="custom") }}

Does not work:

# models/properties.yml
models:
- name: model
  config:
    schema: custom

Reviewers/Stakeholders/SMEs

I'm not sure, sorry.

Related GitHub issues

No response

Additional information

$ dbt --version
Core:
  - installed: 1.10.11
  - latest:    1.10.11 - Up to date!

Plugins:
  - snowflake: 1.10.2 - Up to date!

Metadata

Metadata

Assignees

No one assigned

    Labels

    contentImprovements or additions to contentdbt CoreThe changes proposed in this issue relate to dbt Core

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions