You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Tao Feng (JIRA)" <ji...@apache.org> on 2018/03/03 07:54:00 UTC

[jira] [Created] (AIRFLOW-2172) Cast template_fields into a list if the operator's template_fields has only one element

Tao Feng created AIRFLOW-2172:
---------------------------------

             Summary: Cast template_fields into a list if the operator's template_fields has only one element
                 Key: AIRFLOW-2172
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2172
             Project: Apache Airflow
          Issue Type: Bug
            Reporter: Tao Feng
            Assignee: Tao Feng


Normally user defined operator is derived from BaseOperator. And a jinjafied tuple is created for template_fields. If only one field is provided in the operator's template_fields as following for example:

template_fields = ('hql')

the resolve_template_files method in BaseOperator actually will throw an exception, as the template_fields is now considered as a string instead of a list/tuple. In the example, 'h', 'q', 'l' will all consider template field attribute.

The workaround is to cast template_frields into a list when its actual type is a string. Not sure it is a real bug, but it takes me some time to figure out this issue...



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)