Problem about post_hook with seed reference

Hey :slight_smile:

Sorry for the basic question, I’m new to the tool and I LOVE it !

Here is the topic :
I have a seed called “deleted_records” and that is loaded in my dwh. I want to use it to delete records from another table upon update.

I have a very simple question. Do you know why this works :

{{
config(
materialized=‘incremental’
, unique_key = [‘transaction_nsid’, ‘transaction_line_nsid’]
, post_hook = ‘DELETE FROM {{this}} WHERE transaction_nsid IN (SELECT transaction_nsid FROM [dbo_stg].[deleted_records] )’
)
}}

While this does not :
{{
config(
materialized=‘incremental’
, unique_key = [‘transaction_nsid’, ‘transaction_line_nsid’]
, post_hook = ‘DELETE FROM {{this}} WHERE transaction_nsid IN (SELECT transaction_nsid FROM {{ ref(‘deleted_records’) }} )’
)
}}
Using the source keyword instead of ref does not work either

I hope you can help me :slight_smile:

Have a look at the dbt.log you will find the statements being run.

Note: @Mallegrissimo originally posted this reply in Slack. It might not have transferred perfectly.

fixed it, I used the wrong type of comma in my ref…

here is the solution :

    , post_hook        = 'DELETE FROM {{this}} WHERE transaction_nsid IN ( SELECT transaction_nsid FROM {{ ref("deleted_records") }} )'