vumdao opened a new issue #19489:
URL: https://github.com/apache/airflow/issues/19489


   ### Description
   
   I got following error
   ```
   [2021-11-09, 08:25:30 UTC] {base.py:70} INFO - Using connection to: id: 
rdb_conn_id. Host: rdb, Port: 5432, Schema: configuration, Login: user, 
Password: ***, extra: {'sslmode': 'allow', 'client_encoding': 'utf8'}
   [2021-11-09, 08:25:30 UTC] {taskinstance.py:1703} ERROR - Task failed with 
exception
   Traceback (most recent call last):
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/models/taskinstance.py",
 line 1332, in _run_raw_task
       self._execute_task_with_callbacks(context)
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/models/taskinstance.py",
 line 1458, in _execute_task_with_callbacks
       result = self._execute_task(context, self.task)
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/models/taskinstance.py",
 line 1514, in _execute_task
       result = execute_callable(context=context)
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/operators/python.py", 
line 151, in execute
       return_value = self.execute_callable()
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/operators/python.py", 
line 162, in execute_callable
       return self.python_callable(*self.op_args, **self.op_kwargs)
     File "/opt/airflow/dags/repo/dags/run_configuration.py", line 34, in 
run_job
       dagsUtils.run_step_insert_to_temp_table(tenant, job_name, table_name, 
job_type)
     File 
"/opt/airflow/dags/rev-e3db01f68e7979d71d12ae24008a97065db2144f/dags/utils/dag_util.py",
 line 106, in run_step_insert_to_temp_table
       for df in df_result:
     File "/home/airflow/.local/lib/python3.9/site-packages/pandas/io/sql.py", 
line 1499, in _query_iterator
       data = result.fetchmany(chunksize)
     File 
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/engine/result.py", 
line 1316, in fetchmany
       self.connection._handle_dbapi_exception(
     File 
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", 
line 1514, in _handle_dbapi_exception
       util.raise_(exc_info[1], with_traceback=exc_info[2])
     File 
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", 
line 182, in raise_
       raise exception
     File 
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/engine/result.py", 
line 1311, in fetchmany
       l = self.process_rows(self._fetchmany_impl(size))
     File 
"/home/airflow/.local/lib/python3.9/site-packages/sqlalchemy/engine/result.py", 
line 1224, in _fetchmany_impl
       return self.cursor.fetchmany(size)
   UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 12: 
ordinal not in range(128)
   ```
   
   Try to set `extra` in airflow connection but it does not work
   
![image](https://user-images.githubusercontent.com/37215642/140909372-20805f0c-aa98-44a7-94c2-419aea176f70.png)
   
   or setting as follow does not work neither 
   ```
   extra: {'sslmode': 'allow', 'charset': 'utf8'}
   ```
   
   ### Use case/motivation
   
   See that `airflow/providers/mysql/hooks` support getting `extra` configs 
from airflow connection https://github.com/apache/airflow/pull/6816 but not yet 
for postgresql hook
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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