title: dbt pre-hooks cannot render/find macros?
body: <p>A dbt_project.yml model pre-hook is failing to render macros. The following implementation:</p>
  <pre><code># gold/dbt_project.yml
  
  config-version: 2
  
  ...
  
  models:
      gold:
          +pre-hooks: &quot;{{ incremental_failsafe() }}&quot;
  </code></pre>
  <p>And the following macro:</p>
  <pre><code>-- gold/macros/utils/incremental_failsafe.sql
  
  {% macro incremental_failsafe() %}
  
  {# /*
  Used to wrap AND clauses that should only be run on dev/CI dbt runs.
  
  For example, to limit the number of records scanned on an incremental
  table. This macro will return True unless the target profile is 'prod':
  
  `dbt run --target prod`
  */ #}
  
  {% if target.name == &quot;prod&quot; %}
      {% set incremental_failsafe = False %}
  {% else %}
      {% set incremental_failsafe = True %}
  {% endif %}
  
  {{ log(&quot;Running with incremental_failsafe: &quot; ~ incremental_failsafe, info=True) }}
  {{ return(incremental_failsafe) }}
  
  {% endmacro %}
  
  </code></pre>
  <p>Results in the following:</p>
  <pre><code>(snowflake) Teghans-MacBook-Pro:gold tnightengale$ dbt compile
  Running with dbt=0.17.2
  Encountered an error:
  Compilation Error
    Could not render {{ incremental_failsafe() }}: 'incremental_failsafe' is undefined
  </code></pre>
  <p>I know there was an issue with dbt 0.17.0 around pre-hooks as outlined in <a href="https://getdbt.slack.com/archives/C2JRRQDTL/p1597942307017800" rel="nofollow noreferrer">this slack exchange</a>. I've tried using both <code>+pre-hook:</code> and <code>pre-hook:</code> specs in the yml as suggested in that conversation to no avail, despite the fact that I am running 0.17.2 (not 0.17.0). Any insight would be welcome!</p>
  <h1>EDIT: Solution</h1>
  <p>Truthfully, the answer is so dumb and obvious: the error resulted from having <code>+pre-hooks:</code> as opposed to <code>+pre-hook:</code>. However the suggested answer caused me to take a second look. I am marking it as correct because it gives a lot of helpful context on hooks in general. Cheers!</p>