potiuk commented on PR #33309:
URL: https://github.com/apache/airflow/pull/33309#issuecomment-1682658572
Yes - it looks like it can't be easily changed. the "render_template_fields"
is part of the public interface of the BaseOperator, and chaning it by adding a
session - would not really work as even in our community operators the method
has been already overridden (the method is caled by basenotifier for example
and in sql_to_slack operator - but generally it looks like we cannot **just**
pass a session there : here is the original comment.
```
def render_template_fields(
self,
context: Context,
jinja_env: jinja2.Environment | None = None,
) -> None:
# Ideally we'd like to pass in session as an argument to this
function,
# but we can't easily change this function signature since operators
# could override this. We can't use @provide_session since it closes
and
# expunges everything, which we don't want to do when we are so
"deep"
# in the weeds here. We don't close this session for the same reason.
```
Do you have some other suggestions/ideas how we can do it withouth some kind
of local state where we could keep it to pass it down @uranusjr ? I am out of
ideas (and I think that the session/resource leak is quite problematic and we
should fix it somehow.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]