You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Brian Moser (Jira)" <ji...@apache.org> on 2020/01/03 22:42:00 UTC

[jira] [Created] (AIRFLOW-6445) Templating is not used on "parameters" field (but it should)

Brian Moser created AIRFLOW-6445:
------------------------------------

             Summary: Templating is not used on "parameters" field (but it should)
                 Key: AIRFLOW-6445
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-6445
             Project: Apache Airflow
          Issue Type: Improvement
          Components: database, operators
    Affects Versions: master
            Reporter: Brian Moser


In several database related classes (SqlSensor, MySqlOperator, MsSqlOperator, OracleOperator, PostgresOperator, JdbcOperator, SqliteOperator,  ...) exists a possibility to use parameters with a SQL statement, but templating is not enabled on the parameters, only on the SQL statement itself.

Not using parameters has a performance impact on the database. The db has to parse a SQL statement to find an optimized way to execute it. Because this operation is a performance bottleneck the calculated execution plan is cached and reused when the exact same statement is executed again. But the database only caches a certain number of execution plans, if one application unnecessarily litters the cache with a lot of similar statements, other applications suffer. (More detailed explanation: https://www.akadia.com/services/ora_bind_variables.html)

Therefore please add templating to the parameters so that the actual SQL statement doesn't need to change between runs.

old:
template_fields = ('sql',) # type: Iterable[str]

new:
template_fields = ('sql', 'parameters',) # type: Iterable[str]

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)