[Feature] dbt hooks #5105
Replies: 3 comments
-
Hey @JCZuurmond Thanks for writing this great feature request!! It is definitely on track with the features we are thinking about! There's this custom user-defined task #2381 that's still on our radar! It will be a while(we are pretty far from there) before being able to support it/ having a stable interface for it. But this sounds a lot like what you are after! For running custom Python code, there are a few security concerns for dbt Cloud we have, along the line of:
The guardrail, for now, is that we want dbt to just issue commands but not move any data around. In the meantime, we think you will probably need to hack this together by something like:
|
Beta Was this translation helpful? Give feedback.
-
It would be cool to implement a REST send within these - instant "dbt webhooks"! |
Beta Was this translation helpful? Give feedback.
-
The programmatic invocation of the latest release (v1.5) might be an approach to add hooks. |
Beta Was this translation helpful? Give feedback.
-
Is there an existing feature request for this?
Describe the Feature
Dbt hooks are (optional) pre and post commands a user defines which run before and after dbt commands, respectively. For example:
pre-run
post-run
pre-test
post-test
pre-seed
post-seed
This allows a user to trigger custom processes during a dbt execution, and therefor integrate a custom workflow with dbt's workflow.
Describe alternatives you've considered
To break up your execution plan in steps by using selectors and then running another process in between:
dbt build -s 'project.staging'
<run hook>
dbt build -s 'project.marts'
<run hook>
However, this does not allow you to leverage your pre and post commands with the powerful dbt node selection mechanism. Moreover, in this alternative, the job that triggers dbt needs to be aware about what happens inside your dbt project, where I like to have simple dbt triggers like
dbt build
ordbt build -s source:my_source+
that are unaware about what happens inside your dbt project.Who will this benefit?
Advanced dbt users that want to have workflows that are tightly integrated with dbt's execution.
Are you interested in contributing this feature?
Always - if I find the time
Anything else?
pre- and post-hook
The pre- and post-hook that already exists in dbt are related, though, not the same. These hooks allow you to run a SQL query before or after a dbt model is ran. This feature requests wants to run a python function, which is more flexible.
Git hooks
This request is inspired by git hooks. Commonly used and known through the pre-commit package. Git hooks allow you to define pre and post command for
git
commands likecommit
,push
andpull
. Have a look in the.git/hooks/
folder!Beta Was this translation helpful? Give feedback.
All reactions