[
https://issues.apache.org/jira/browse/AIRFLOW-3139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16641867#comment-16641867
]
ASF GitHub Bot commented on AIRFLOW-3139:
-----------------------------------------
ashb closed pull request #3986: [AIRFLOW-3139] include parameters into log.info
in SQL operators, if any
URL: https://github.com/apache/incubator-airflow/pull/3986
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/airflow/hooks/dbapi_hook.py b/airflow/hooks/dbapi_hook.py
index 5b50ade34e..bb2c20c188 100644
--- a/airflow/hooks/dbapi_hook.py
+++ b/airflow/hooks/dbapi_hook.py
@@ -163,10 +163,11 @@ def run(self, sql, autocommit=False, parameters=None):
for s in sql:
if sys.version_info[0] < 3:
s = s.encode('utf-8')
- self.log.info(s)
if parameters is not None:
+ self.log.info("{} with parameters {}".format(s,
parameters))
cur.execute(s, parameters)
else:
+ self.log.info(s)
cur.execute(s)
# If autocommit was set to False for db that supports autocommit,
----------------------------------------------------------------
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:
[email protected]
> Include parameters into log.info for SQL-operators if any
> ---------------------------------------------------------
>
> Key: AIRFLOW-3139
> URL: https://issues.apache.org/jira/browse/AIRFLOW-3139
> Project: Apache Airflow
> Issue Type: Improvement
> Components: operators
> Reporter: Xiaodong DENG
> Assignee: Xiaodong DENG
> Priority: Minor
> Attachments: Screen Shot 2018-10-02 at 3.24.21 PM.png
>
>
> For SQL-operators based on {color:#a6e22e}DbApiHook{color}, like
> SqliteOperator, PostgresOperator, the SQL command itself will be printed into
> log INFO.
> But if parameters are used for the sql command, the parameters are not
> printed. This makes the logging less useful.
>
> *Example:*
> !Screen Shot 2018-10-02 at 3.24.21 PM.png|width=818,height=61!
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)