msardana94 opened a new pull request #17214:
URL: https://github.com/apache/airflow/pull/17214


   This change addresses the below mentioned issues:
   1. Currently, the `PostgresOperator` logs the sql twice (once by `execute` 
method of operator and once by the underlying `run()` method of `DbApiHook`. 
For anyone looking at the logs, it appears the SQL ran twice which is not the 
case. Here's an example log file:
   ```log
   [2021-07-25 00:01:02,825] {logging_mixin.py:112} INFO - Running 
<TaskInstance: example_dag.example_task 2021-07-24T04:00:00+00:00 [running]> on 
host 12345567
   [2021-07-25 00:01:02,848] {postgres.py:69} INFO - Executing: truncate table 
XYZ;
   [2021-07-25 00:01:02,857] {base_hook.py:89} INFO - Using connection to: id: 
app_db. Host: abc.com, Port: 5432, Schema: test, Login: some_user, Password: 
XXXXXXXX, extra: XXXXXXXX
   [2021-07-25 00:01:02,867] {dbapi_hook.py:176} INFO - truncate table XYZ;
   [2021-07-25 00:01:03,120] {taskinstance.py:1070} INFO - Marking task as 
SUCCESS.dag_id=example_dag, task_id=some_task, execution_date=20210724T040000, 
start_date=20210725T040102, end_date=20210725T040103
   
   ```
   2. The `copy_expert` method of `PostgresHook` doesn't currently log the SQL 
executed against the db. This is helpful for debugging especially if you are 
calling `copy_expert` method directly as opposed to via `bulk_load` or 
`bulk_dump`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to