Advanced automation – hooks and run-operations
With environments, jobs, and configuration, you can design your architecture and deploy and run your data platform using one or more dbt projects, but other activities are needed to keep a data platform up and running beyond data transformations.
In this chapter, we will look at two advanced functionalities, hook
and run-operation
commands, and the use of the latter to handle the database migrations that are not handled by dbt.
Both these functionalities allow you to execute the arbitrary SQL that you need to complement dbt transformations. It could be from creating user functions to managing grants or doing database-specific operations such as cloning or vacuuming or creating shares or running any other command besides creating tables/views and transforming data.
The main difference between the two functionalities lies in when the SQL must be activated: connected to some model life cycle or independent of it.