Access to the params argument in a custom operator in Apache Airflow

Same here. I've just spent a few hours (days?) to find out the cause of the problem (god save IPython.embed and logging). As of Airflow 1.10.3, it's caused by TaskInstance.render_templates(), which won't update the Jinja context, only the task attibute, after rendering any of the template_fields or template_exts. See it here!

Therefore you just have to use

{{ task.params.whatever }}

instead of

{{ params.whatever }}

In your .sql template files.

As a matter of fact, if Jinja context would be updated continuously, then one would really have to pay attention to the order and dependencies of the templates. It's kind of a nested/recursive rendering. It could also have performance downsides.

Also, I would not recommend to use "parameters" (which is not the same as "params"), as they seem to be intended to be passed to database cursors as parameters, and then you won't be able to pass numbers/integers, column or table names, or simply an SQL fragment (e.g. where, having, limit, ...).