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
Consider supporting Expression Statements #83
Comments
Since MiniJinja has no real mutables, I'm not sure if this is super useful. Do you have an actual example in mind in MiniJinja? |
Sure, so my usecase is that dbt-utils (a helper library for dbt, I'm going to be talking about this a bit, sorry 🥲) uses this for when a function/macro returns something that we want to ignore. All I think it really does is consume the output of the macro/functions calls? So in the parser we would add a "Do" block with a I'd be happy to contribute this feature. |
I'm not opposed but I'm curious how these macros or functions have side effects. I assume this would always have to go through some dynamic object exposed to the template? |
Yep, so for example run_query would execute and return results, so it's dynamic. |
Right. But in that case if you don't use the return value why fire the query? The utility of |
@joshuataylor is this issue still relevant? |
It was mostly for BC to support existing code, but decided to just not support it :). So happy for this to be closed. |
In Jinja, there is an extension called "expression statements":
https://jinja.palletsprojects.com/en/3.1.x/extensions/#expression-statement
These are super handy, you can do things like this:
https://jinja.palletsprojects.com/en/3.1.x/templates/#expression-statement
Thoughts? (Happy to submit this)
The text was updated successfully, but these errors were encountered: