-
Notifications
You must be signed in to change notification settings - Fork 951
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
python model reference f"{dbt.ref('test5')}" #4838
Comments
@runleonarun adding Copilot summaryThis 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. 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. tests/unit/test_parser.py: Modified the model function to include f-string usage. This change tests the parser's ability to correctly interpret f-strings. |
thank you @runleonarun ! working on this now! |
hey @ChenyuLInx are we saying there is now another way to ref python models? so:
or is the |
hey @ChenyuLInx , friendly nudge if you have any clarification on this pls? thank you! |
Hey @mirnawong1 , the change means that when using a config in a python f string, the config will be available in python models. Here's an example:
will be None, but after this change, it will actually print 5. |
this pr adds a new code change that support for dbt function calls in f-strings. added section on how to dynamically access this. Resolves #4838
f"{dbt.ref('test5')}"
is now a supported way to reference a model in a python model
cc: @ChenyuLInx
The text was updated successfully, but these errors were encountered: