Chapter 18 Hooks
At one time, I posed a question to a well-versed data engineer of why the technological space seems to be awash with exotic, outlandish names. Hooks in dbt seem to fit into the calibre of these outlandish names… for there is nothing regarding its purpose in dbt which seems to suggest it will lure and capture your data.
You could take hooks as customized SQL models that are out of the box when it comes to dbt. There are various forms of hooks, namely:
pre-hook
- executed before a model, snapshot or seed is built.post-hook
- executed after a model, snapshot or seed is built.on-run-start
- executed at the start of implementing the following code executions:dbt build
,dbt compile
,dbt docs generate
,dbt run
,dbt seed
,dbt snapshot
ordbt test
.on-run-end
- executed at the end of the following code executions:dbt build
,dbt compile
,dbt docs generate
,dbt run
,dbt seed
,dbt snapshot
ordbt test
.
A confession to make: since I have minimal experience using hooks, I shall play it safe, thus the reason why this chapter is quite short.