You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2018/12/07 02:26:59 UTC

[GitHub] galak75 opened a new pull request #4292: [AIRFLOW-2508] Handle non string types in Operators templatized fields

galak75 opened a new pull request #4292: [AIRFLOW-2508] Handle non string types in Operators templatized fields
URL: https://github.com/apache/incubator-airflow/pull/4292
 
 
   ### Jira
   
   This PR addresses [[AIRFLOW-2508] Handle non string types in render_template_from_field](https://issues.apache.org/jira/browse/AIRFLOW-2508)
   
   ### Description
   
   This PR changes `BaseOperator.render_template_from_field` method behavior: 
   - it was previously rendering `string_types` and supporting `Number`s (and collections or dictionaries of these types); but it was raising an `AirflowException` on any other type.
   - it is now supporting any other type (by returning the value as is)
   
   ### Tests
   
   This PR adds the following unit tests on `BaseOperator.render_template_from_field` method:
   - rendering a list of strings
   - rendering a tuple of strings
   - rendering dictionary values
   - showing dictionary keys are not templatized
   - returning a `date` as is
   - returning a `datetime` as is
   - returning a `UUID` as is
   - returning an `object` as is
   
   ### Notice
   
   **This PR adds [pyhamcrest](http://hamcrest.org/) to Airflow _test dependencies_.** This module helps writing meaningful assertions, and also provides very clear and helpful messages on test failures.
   
   If Airflow maintainers do not want to include this test module, just let me know, and I'll rework unit tests 
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services