dbt-labs / redshift

Redshift package for dbt (getdbt.com)
https://hub.getdbt.com/dbt-labs/redshift/latest/
Apache License 2.0
99 stars 41 forks source link

Redshift maintenance macro improvements #22

Closed clrcrl closed 4 years ago

clrcrl commented 4 years ago
  1. Check that the relation exists before trying to vacuum this. This can be a source of failures for long running vacuums
  2. Create logic for "respect my project's get_vacuumable_tables macro, otherwise, use the default implementation
{% macro redshift_maintenance() %}
    {% if context[ref.config.project_name].get_vacuumable_tables %}
        {% set vacuumable_tables=context[ref.config.project_name].get_vacuumable_tables() %}
    {% else %}
        {% set vacuumable_tables=redshift.get_vacuumable_tables() %}
    {% endif %}

    {% for table in vacuumable_tables %}
       ...
    {% endfor %}

{% endmacro %}
clrcrl commented 4 years ago

Closed by #25