Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

target.schema not included in path to tag when dbt_tags__opt_in_default_naming_config is false #21

Closed
1 task
CadenSenitteGit opened this issue Nov 18, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@CadenSenitteGit
Copy link

CadenSenitteGit commented Nov 18, 2024

Describe the bug

There was a recent change to the second macro in the get_resource_ns.sql file. There is a syntax issue with a parenthesis. Within the else statement (when dbt_tags__opt_in_default_naming_config = false), this is what is returned:

{{ return(var("dbt_tags__database", target.database)) ~ "." ~ var("dbt_tags__schema", target.schema) }}

The second parenthesis after target.database should be removed and added to the end of target.schema, so that the schema var is included in the return statement. Should look like this:

{{ return(var("dbt_tags__database", target.database) ~ "." ~ var("dbt_tags__schema", target.schema)) }}

Steps to reproduce

  • In dbt_project.yml, set the var dbt_tags__opt_in_default_naming_config: false
  • In dbt_project.yml, set a the vars for dbt_tags__database and dbt_tags__schema to desired values.
  • Execute a dbt run or build

Expected results

The tag is found at the specified target_database.target_schema

Actual results

The tag cannot be found because the macro is looking for it in target.database, but not including the target.schema in the path.

Screenshots and log output

System information

The contents of your packages.yml file:

Which database are you using dbt with?

  • [x ] snowflake
  • other (specify: ____________)

The output of dbt --version:

<output goes here>

Additional context

The issue is line 9 of the get_resource_ns.sql file. There was a recent commit to that line that needs refactoring. The parenthesis just needs to be moved to the end of target.schema so that the schema var is included in the return statement.

Are you interested in contributing the fix?

@CadenSenitteGit CadenSenitteGit added the bug Something isn't working label Nov 18, 2024
@il-dat
Copy link
Collaborator

il-dat commented Nov 19, 2024

Thanks @CadenSenitteGit for raising this bug!

This was my bad, it was too rushed yesterday so I made a fix incorrectly.
It should be fixed in v1.3.1 now - sorry for the inconvenience here!

@CadenSenitteGit
Copy link
Author

@il-dat no worries, thank you for the fix, worked great today!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants