-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix python model parsing from meder #9162
Conversation
@@ -797,6 +797,7 @@ def model(dbt, session): | |||
a_dict = {'test2': dbt.ref('test2')} | |||
df5 = {'test2': dbt.ref('test3')} | |||
df6 = [dbt.ref("test4")] | |||
f"{dbt.ref('test5')}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jtcohen6 @graciegoheen With this change, now this syntax is supported to add a ref.
I don't feel like it is a bad thing, just a change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok we should just make sure our docs our updated cc: @matthewshaver
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9162 +/- ##
==========================================
+ Coverage 86.96% 86.99% +0.03%
==========================================
Files 187 187
Lines 24953 24957 +4
==========================================
+ Hits 21700 21712 +12
+ Misses 3253 3245 -8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Opened a new issue in dbt-labs/docs.getdbt.com: dbt-labs/docs.getdbt.com#4838 |
resolves #6976
Bring #7740 over finish line by adding a unittest. Thanks @mederka for adding it!
@runleonarun adding Copilot summary
This pull request primarily focuses on fixing the parsing of f-strings in Python models. The changes include adding support for dbt function calls in f-strings, modifying test cases to include f-string usage, and adding a new test case specifically for f-string configuration.
Fixes and improvements:
.changes/unreleased/Fixes-20231128-102111.yaml
: Announced the fix for parsing f-strings in Python models.Changes to the Python model parser:
core/dbt/parser/models.py
: Added support for dbt function calls in f-strings. This change allows the parser to correctly interpret dbt function calls that are embedded within f-strings.Changes to the test cases:
tests/unit/test_parser.py
: Modified themodel
function to include f-string usage. This change tests the parser's ability to correctly interpret f-strings.tests/unit/test_parser.py
: Added a new Python model that uses f-strings. This model is used in a new test case that verifies the correct parsing of f-strings.tests/unit/test_parser.py
: Modified thetest_python_model_parse
function to include a new reference argument that uses f-strings. This change tests the parser's ability to correctly interpret reference arguments within f-strings.tests/unit/test_parser.py
: Added a new test casetest_python_model_f_string_config
to verify the correct parsing of f-string configuration in Python models.