# Evaluation of \`{{this}}\`

**URL:** <https://discourse.getdbt.com/t/evaluation-of-this/17120>\
**Category:** Help\
**Created:** [November 26, 2024, 5:14pm UTC](https://discourse.getdbt.com/t/evaluation-of-this/17120 "2024-11-26T17:14:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeffsk](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/jeffsk/32/1250_2.png) [@jeffsk](https://discourse.getdbt.com/u/jeffsk)\
**Post date:** [November 26, 2024, 5:14pm UTC](https://discourse.getdbt.com/t/evaluation-of-this/17120/1 "2024-11-26T17:14:25Z")

</div>

I came across an interesting “feature” of dbt today that was not noticed until we got to Production.

If you configure a model like this:

```auto
{%- set post_hook_sql -%}
delete from {{ this }}
where stuff
{%- endset -%}

{{
    config(
        materialized="incremental",
        unique_key="snapshot_key",
        full_refresh=false,
        post_hook=[post_hook_sql]
    )
}}

```

dbt is not fully aware of your schema configuration at the time the jinja variable is set. It will resolve to `default` schema instead of custom schema.

In order to get the schema name to resolve correctly (not use `default` schema), you need to call `{{this}}` in the config block instead. For example, this resolves to the correct schema:

```auto
{{
    config(
        materialized="incremental",
        unique_key="snapshot_key",
        full_refresh=false,
        post_hook=["delete from {{this}} where stuff"]
    )
}}

```

Questions:

- Why?
- Is this on purpose or is it some side effect?
- Is it worth creating an issue on GitHub?

---

<div class="post-metadata">

**Author:** ![wilson.yip](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/wilson.yip/32/4931_2.png) [@wilson.yip](https://discourse.getdbt.com/u/wilson.yip)\
**Post date:** [November 26, 2024, 5:20pm UTC](https://discourse.getdbt.com/t/evaluation-of-this/17120/2 "2024-11-26T17:20:03Z")

</div>

Not sure if it helps. But I guess it is worth trying

```sql
{% if execute %}
{%- set post_hook_sql -%}
delete from {{ this }}
where stuff
{%- endset -%}
{% endif %}

```
