Macro redshift_maintenance
errors if custom ref()
macro exists in project
#52
Labels
redshift_maintenance
errors if custom ref()
macro exists in project
#52
Describe the bug
The
redshift_maintenance
macro throws a "Compilation Error" if a project has overridden the built inref()
macro (example of how/why one might do that).Steps to reproduce
ref()
macro (e.g.macros/not_really_custom_ref.sql
) override that doesn't really do anything:dbt run-operation redshift_maintenance
.Expected results
Expected tables to be vacuumed and stdout to having something like:
Note: above is the result of NOT having a custom
ref()
override.Actual results
A
dbt.exceptions.CompilationException
is raised instead:Screenshots and log output
Stdout with
--debug
:Click to expand!
System information
The contents of your
packages.yml
file:Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using:
The output of
python --version
:Additional context
This looks to be caused by the following 2 lines that try to get the root project name from the
ref.config
attribute - which is unavailable if a user manually overridesref
with their own.redshift/macros/redshift_maintenance_operation.sql
Lines 32 to 33 in 48d6be2
As of dbt 0.16, the
project_name
looks to be available without taking it fromref.config
so we can change the above 2 lines to be something like:P.s. I did test the above code change and found that it worked - submitting PR after this issue :)
The text was updated successfully, but these errors were encountered: