in_transaction
macro for pre- / post-hooks
#6226
Labels
content
Improvements or additions to content
improvement
Use this when an area of the docs needs improvement as it's currently unclear
Contributions
Link to the page on docs.getdbt.com requiring updates
https://docs.getdbt.com/reference/resource-configs/pre-hook-post-hook#transaction-behavior
What part(s) of the page would you like to see updated?
dbt has a macro named
in_transaction
(#510). Handy!It didn't show up in a search in our docs though:
You can use it (along with its siblings
before_begin
andafter_commit
) to add arbitrary user-defined statements in 4 different places:Example
That isn't the only way to do it, of course. If using a dictionary looks like more fun to you, knock yerself out:
Additional information
The main caveat is that not all dbt adapters support transactions. There is already a caveat for this, but I'm not sure if it's fully up-to-date or not (#6225):
The text was updated successfully, but these errors were encountered: