Hello All
Can we use vars in Hooks query?
Iam trying to run below dbt command and it’s fails with below error:
e[0m16:47:20.468451 [error] [MainThread]: e[33mObject of type date is not JSON serializablee[0m
dbt command: dbt snapshot --select customer_snapshot --vars ‘{execution_date:2022-11-05}’
DBT Model
{% snapshot customer_snapshot %}
{{
config(
unique_key=‘customer_id’,
strategy=‘check’,
check_cols=[‘customer_id’, ‘customer_name’],
post_hook=[“delete project.dataset.customer_details set status= ‘Y’ where ingestion_date =‘{{var(‘execution_date’)}}’”]
) }}
select * from project.dataset.customer_details
where ingestion_date = “{{ var(‘execution_date’) }}” and status= ‘N’
{% endsnapshot %}
Regards
Minhaj Pasha