potiuk commented on PR #33309:
URL: https://github.com/apache/airflow/pull/33309#issuecomment-1678487753

   The main reason was the signature of the render_templelate method that could 
not be changed for the regular non-mapped operator. 
   
   At least that"s what the comment says in the original comment.
   
   The regular operators do not need the session at all. And we are extending 
the regular operator methods. So this is the main reason why we cannot pass the 
session directly. And the only one.
   
   The way it was implemented created (and not closed) a new session. It did 
not close it because it was  hard with the recursive patterns of template 
rendering.
   
   The way I implemented it now - we so not create new session. But use the one 
that comes with the task - and close it when run method completes. This Is the 
same as creating session but without the overhead of creating a new one - just 
reusing one that we already have 
   
   So basically we are doing what we've been doing already but with one session 
rather than two - and we are closing the session when. It is not needed. This 
is the saving we have.
   
   Do you see any flaw with this reasoning? Do you think it's not worthy a 
saving of extra session and db connection created always when mapped operator 
is running? I think it is quite significant improvement TBH, without -seemingly 
- any drawback.


-- 
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]

Reply via email to