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

catch generic exception in catch_jinja and reraise as CompilationError #224

Merged
merged 4 commits into from
Dec 4, 2024

Conversation

MichelleArk
Copy link
Collaborator

@MichelleArk MichelleArk commented Dec 1, 2024

resolves #225

Description

Catch generic Exception and re-raise as compilation error with node context for improved user. debugging experience.

Checklist

🎩

-- test_model.sql
{% set yesterday = modules.datetime.datetime(2002, 13, 27, 6, 0, 0) %}
select 1 as x, timestamp '2024-10-28' as event_time
union all
select 2 as x, timestamp '2024-10-29' as event_time
union all
select 4 as x, timestamp '2024-10-31' as event_time
union all
select 5 as x, timestamp '2024-11-01' as event_time
union all
select 5 as x, timestamp '2024-11-01' as event_time
union all
select 6 as x, timestamp '2024-11-07' as event_time
❯ dbt parse
14:15:14  Running with dbt=1.9.0-rc1
14:15:15  Registered adapter: bigquery=1.9.0-b1
14:15:15  Encountered an error:
Compilation Error in model test_model (models/test_model.sql)
  month must be in 1..12

@cla-bot cla-bot bot added the cla:yes label Dec 1, 2024
Copy link

github-actions bot commented Dec 1, 2024

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2024

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 68.42%. Comparing base (f1f6e6f) to head (058ed7e).

Files with missing lines Patch % Lines
dbt_common/clients/jinja.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #224      +/-   ##
==========================================
- Coverage   68.50%   68.42%   -0.09%     
==========================================
  Files          52       52              
  Lines        3391     3395       +4     
==========================================
  Hits         2323     2323              
- Misses       1068     1072       +4     
Flag Coverage Δ
unit 68.42% <0.00%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MichelleArk MichelleArk marked this pull request as ready for review December 2, 2024 14:08
@MichelleArk MichelleArk requested a review from a team as a code owner December 2, 2024 14:08
@MichelleArk
Copy link
Collaborator Author

For good measure, running dbt-core tests here before merging

@MichelleArk
Copy link
Collaborator Author

Re-running dbt-core tests here: https://github.com/dbt-labs/dbt-core/actions/runs/12122320481?pr=11085

@MichelleArk MichelleArk added this pull request to the merge queue Dec 4, 2024
Merged via the queue into main with commit b3fc73c Dec 4, 2024
15 checks passed
@MichelleArk MichelleArk deleted the catch-jinja-generic-exception branch December 4, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants