galak75 commented on issue #4743: [AIRFLOW-3871] render Operators template 
fields recursively
URL: https://github.com/apache/airflow/pull/4743#issuecomment-472148500
 
 
   @bjoernpollex-sc : thanks a lot for your feedback
   I actually didn't see your comment on Jira. I do not understand why it did 
not pop up.
   
   I have some questions about it:
   
   > There might be fields I don't want rendered (maybe I use Jinja templating 
internally)
   
   This is a good point. In such a case, shouldn't Airflow templating process 
be preferred?
   
   ----
   
   > Due to the dynamic nature of Python, I might want to render fields that 
can't be found via introspection
   
   I'm pretty new with python, how this could happen? Isn't introspection meant 
to provide all existing attributes, methods, and so on, on an object? Do you 
have any example or reading about it?
   
   ----
   
   > I think a viable alternative would be to use the same approach as for 
operators - declare which fields need templating using a template_fields class 
variable.
   
   It is a good alternative to avoid the first point: just choose the fields we 
want to be templated.
   But then, we need to manipulate a class (add a class attribute) to make sure 
its fields will be rendered. 
   
   One thing I really appreciate with approach # 3 is that is works without any 
change on classes. just setting a templated value on any attribute from any 
class (in an operator template_field), and this value will be rendered during 
DAG execution.
   
   If we have to customize a class so that its inner fields are templated, 
would you rather add a `template_field` class attribute, or define a 
`render_template` custom method (approach # 2)
   
   I hope I'm clear enough... Thank you in advance for your answer.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to