+1 I like the idea. Setting `template_ext=['.sh']` in an operator class
would mean rendering both `.sh` and `.sh.jinja2` (and possibly `.j2`) files.

On Wed, Apr 29, 2020 at 5:39 AM Ori Popowski <ori....@gmail.com> wrote:

> At the moment, various operators support reading templates from given
> filenames (for example, `bash_command` of `BashOperator`). However, all of
> these operators specify extensions such as .sh, .json etc., so it means
> users need to write Jinja2 templates inside .sh, .json files. This is
> problematic for 3 reasons:
>
> 1. No semantic support when writing templates (major IDEs support this
> extension, including Github itself)
> 2. It's not aligned to widespread convention of naming template files with
> .jinja2 extension
> 3. It's harder to distinguish between template files and non-template files
>
> A better way to do it would be supporting the .jinja2 extension.
>
> The proposition at the moment is to globally accept .jinja2 extension in
> `BaseOperator` whenever `template_ext` is defined. It means that all
> inheriting operators will now automatically support their already defined
> extensions but also with .jinja2 appended to them (i.e. if you have
> `template_ext = ('.json', '.yml')` then also .json.jinja2 and .yml.jinja2
> will be added)).
>
> Since this affects a vast part of the codebase, this suggestion is open to
> discussion. WDYT?
>
> For more info, see
> https://urldefense.com/v3/__https://github.com/apache/airflow/issues/8603__;!!MeEMYEo!E7idudrJJUmicBplTDGxBMNwCy32aOW_GG0uhxVXbUqWxtes_iRwL8JpBcpz$
>


-- 
Edgar Ramírez Mondragón
Python Developer
55 3723 0202

Reply via email to