Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbt retry command #3556

Merged
merged 9 commits into from
Jun 26, 2023
4 changes: 4 additions & 0 deletions website/dbt-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ exports.versions = [
]

exports.versionedPages = [
{
"page": "reference/commands/retry",
"firstVersion": "1.6",
},
{
"page": "docs/build/groups",
"firstVersion": "1.5",
Expand Down
22 changes: 22 additions & 0 deletions website/docs/reference/commands/retry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: "About dbt retry command"
sidebar_label: "retry"
id: "retry"
---

`dbt retry` re-executes the last `dbt` command from the node point of failure. If the previously executed `dbt` command was successful, `retry` will finish as no operation.
matthewshaver marked this conversation as resolved.
Show resolved Hide resolved

Retry works with the following commands:

- [`build`](/reference/commands/build)
- [`compile`](/reference/commands/compile)
- [`seed`](/reference/commands/seed)
- [`snapshot`](/reference/commands/build)
- [`test`](/reference/commands/test)
- [`run`](/reference/commands/run)
- [`run-operation`](/reference/commands/run-operation)

`dbt retry` will execute from the node failures recorded in the run_results.json. Executing `dbt retry` without correcting the previous failures will garner idempotent results.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good place to add a glossary entry for idempotent. https://docs.getdbt.com/terms/idempotent which I think would be:
<Term id="idempotent" />

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dbt retry will execute from the node failures recorded in the run_results.json

What is the advice here? Are we asking people to make sure they check run_resuts.json and fix any failures?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're not expected to do anything with the file itself, we just wanted to give a behind the curtains look at how the feature works. It references that json to determine where to start the retry. Does adding the parenthesis help?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@runleonarun Users should not edit run_results.json themselves, but its output is used by retry.

matthewshaver marked this conversation as resolved.
Show resolved Hide resolved

`dbt retry` reuses the selectors from the previously executed command.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we link to the Methods page or YAML selectors page to provide more info in case they need it?

matthewshaver marked this conversation as resolved.
Show resolved Hide resolved

1 change: 1 addition & 0 deletions website/docs/reference/dbt-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Use the following dbt commands in the [CLI](/docs/core/about-the-cli) and use th
- [init](/reference/commands/init): initializes a new dbt project
- [list](/reference/commands/list): lists resources defined in a dbt project
- [parse](/reference/commands/parse): parses a project and writes detailed timing info
- [retry](/reference/commands/retry): retry the last run `dbt` command from the point of failure (requires dbt 1.6 or higher)
- [rpc](/reference/commands/rpc): runs an RPC server that clients can submit queries to
- [run](/reference/commands/run): runs the models in a project
- [run-operation](/reference/commands/run-operation): invoke a macro, including running arbitrary maintenance SQL against the database
Expand Down
1 change: 1 addition & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@ const sidebarSettings = {
"reference/commands/init",
"reference/commands/list",
"reference/commands/parse",
"reference/commands/retry",
"reference/commands/rpc",
"reference/commands/run",
"reference/commands/run-operation",
Expand Down