I am writing a pre hook and a post-hook for my dbt models to create a table with details of my models like execution time etc, what i would like to know is how to ensure that the values are inserted in the same row. i am using insert command in my pre-hook and update command in post-hook. however i am having trouble in adding them to the same row. i cannot use model name as the primary key because i may run each model multiple times. so i created a self incremental column called key which is to be my primary key. so how do i collect the key column value from the pre hook and use it in the post hook?.
I am using postgres as warehous
RETURNING audit_key INTO audit_key_var;
I tried using this as recommended by chat gpt but the post-hook does not recognize or has value of audit_key_var.
Kanishk Pincha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.