Skip to content

Commit

Permalink
align commands for on run start/end (#4160)
Browse files Browse the repository at this point in the history
per [community
slack](https://getdbt.slack.com/archives/C0441GSRU04/p1695989576306639)
feedback, this change adds a partial to ensure the two docs that explain
which commands should be used for on run start and on run end.
  • Loading branch information
mirnawong1 authored Sep 29, 2023
2 parents ae213d4 + 5836b23 commit 24574a9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
6 changes: 4 additions & 2 deletions website/docs/docs/build/hooks-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Read this tutorial to learn how to use hooks and operations when b
id: "hooks-operations"
---

import OnRunCommands from '/snippets/_onrunstart-onrunend-commands.md';

## Related documentation
* [pre-hook & post-hook](/reference/resource-configs/pre-hook-post-hook)
* [on-run-start & on-run-end](/reference/project-configs/on-run-start-on-run-end)
Expand Down Expand Up @@ -33,8 +35,8 @@ dbt provides hooks and operations so you can version control and execute these s
Hooks are snippets of SQL that are executed at different times:
* `pre-hook`: executed _before_ a model, seed or snapshot is built.
* `post-hook`: executed _after_ a model, seed or snapshot is built.
* `on-run-start`: executed at the _start_ of `dbt run`, `dbt test`, `dbt seed` or `dbt snapshot`
* `on-run-end`: executed at the _end_ of `dbt run`, `dbt test`, `dbt seed` or `dbt snapshot`
* `on-run-start`: executed at the _start_ of <OnRunCommands/>
* `on-run-end`: executed at the _end_ of <OnRunCommands/>

Hooks are a more-advanced capability that enable you to run custom SQL, and leverage database-specific actions, beyond what dbt makes available out-of-the-box with standard materializations and configurations.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Read this guide to understand the on-run-start and on-run-end conf
datatype: sql-statement | [sql-statement]
---

import OnRunCommands from '/snippets/_onrunstart-onrunend-commands.md';

<File name='dbt_project.yml'>

```yml
Expand All @@ -15,14 +17,8 @@ on-run-end: sql-statement | [sql-statement]
## Definition
A SQL statement (or list of SQL statements) to be run at the start, or end, of the following commands:
- `dbt run`
- `dbt test`
- `dbt seed`
- `dbt snapshot`
- `dbt build`
- `dbt compile`
- `dbt docs generate`
A SQL statement (or list of SQL statements) to be run at the start or end of the following commands: <OnRunCommands />
`on-run-start` and `on-run-end` hooks can also call macros that return SQL statements

Expand Down
1 change: 1 addition & 0 deletions website/snippets/_onrunstart-onrunend-commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<code>dbt build</code>, <code>dbt compile</code>, <code>dbt docs generate</code>, <code>dbt run</code>, <code>dbt seed</code>, <code>dbt snapshot</code>, or <code>dbt test</code>.

0 comments on commit 24574a9

Please sign in to comment.