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

[Feature] Get dbt retry working even when there are compilation errors #10590

Closed
2 tasks done
aranke opened this issue Aug 21, 2024 · 4 comments
Closed
2 tasks done

[Feature] Get dbt retry working even when there are compilation errors #10590

aranke opened this issue Aug 21, 2024 · 4 comments
Labels
enhancement New feature or request wontfix Not a bug or out of scope for dbt-core

Comments

@aranke
Copy link
Member

aranke commented Aug 21, 2024

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

If we have a compilation error during dbt run, dbt retry has no nodes to pick up.

Expected Behavior

dbt retry should retry all nodes that were failed/skipped.
The fix here might be marking nodes as failed/skipped during compilation errors.

Steps To Reproduce

Step 1: Remove closing }} from one of the Jinja templates

❯ dbt run
21:58:09  Running with dbt=1.8.3
21:58:09  Registered adapter: duckdb=1.8.1
21:58:09  Encountered an error:
Compilation Error in model stg_customers (models/staging/stg_customers.sql)
  unexpected ')'
    line 11
      ),

Step 2: Fix model and retry

❯ dbt retry
21:58:24  Running with dbt=1.8.3
21:58:24  Registered adapter: duckdb=1.8.1
21:58:24  Found 5 models, 3 seeds, 20 data tests, 409 macros
21:58:24  
21:58:24  Nothing to do. Try checking your model configs and model specification args

Relevant log output

No response

Environment

No response

Which database adapter are you using with dbt?

No response

Additional Context

No response

@aranke aranke added bug Something isn't working triage labels Aug 21, 2024
@dbeatty10
Copy link
Contributor

Let's say that you have the following model:

models/my_model.sql

select {{ dbt.string_literal("A")  as letter

Then you do the following:

dbt clean
dbt run -s my_model

None of dbt run, dbt build, etc. will produce target folder (and associated artifacts) due to the compilation error, so how could we possibly do a dbt retry?

@aranke
Copy link
Member Author

aranke commented Aug 22, 2024

None of dbt run, dbt build, etc. will produce target folder (and associated artifacts) due to the compilation error

I guess the question we should answer here is whether they should?
I could see a case either way, will defer to yourself, @jtcohen6, @graciegoheen to answer this question.

If we decide not to do this work, it feels like a gotcha worth documenting.

@dbeatty10 dbeatty10 added enhancement New feature or request and removed bug Something isn't working labels Aug 22, 2024
@dbeatty10 dbeatty10 changed the title [Bug] Get dbt retry working with compilation errors [Feature] Get dbt retry working even when there are compilation errors Aug 22, 2024
@dbeatty10
Copy link
Contributor

@aranke Thanks for discovering this gotcha!

I relabeled this as a feature request, since I'd expect a successful parse to be a prerequisite for retry. (Put another way, I wouldn't expect dbt retry to work in the case where the project can't be parsed.)

It seems like it would be both a big shift and significant work to generate target artifacts even when parsing doesn't succeed, so I'm going to close this in favor of updating the documentation: dbt-labs/docs.getdbt.com#5964.

We can always re-open if @jtcohen6 or @graciegoheen end up wanting this.

@dbeatty10 dbeatty10 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 22, 2024
@dbeatty10 dbeatty10 added wontfix Not a bug or out of scope for dbt-core and removed triage labels Aug 22, 2024
@graciegoheen
Copy link
Contributor

graciegoheen commented Aug 27, 2024

Put another way, I wouldn't expect dbt retry to work in the case where the project can't be parsed.

Is this because nothing would ever be built in the run since the parse would fail? In that case should we just retry the prior command? Or have a clearer error message?

From a user perspective, I can understand it would be unexpected for dbt retry not to work when the prior command failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix Not a bug or out of scope for dbt-core
Projects
None yet
Development

No branches or pull requests

3 participants