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

BUG: dbt-utils drop_old_relations doesn't take into account model aliases #99

Open
SFL-PR opened this issue Nov 10, 2023 · 0 comments
Open

Comments

@SFL-PR
Copy link

SFL-PR commented Nov 10, 2023

Hi all, first contribution to a project so please let me know if I've done anything wrong! 😄

Only a small change but a key one for the functionality of this macro, I think.

Currently, when collecting the models names to check presence in the target DB, the macro only looks at node.name. This means aliased models are not checked correctly and models still in use are dropped.

Simple suggested solution is to swap current_models.append(node.name) with current_models.append(node.name if node.config.alias == None else node.config.alias)

@SFL-PR SFL-PR changed the title dbt-utils drop_old_relations doesn't take into account model aliases BUG: dbt-utils drop_old_relations doesn't take into account model aliases Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant