juditkuti opened a new issue, #28524:
URL: https://github.com/apache/airflow/issues/28524

   ### Description
   
   Currently we see an error whenever the dw-redshift airflow connection is 
called in our DAGs. It doesn't block running the DAGs but it would be better to 
have less noisy logs. This issue is due to File 
"/usr/local/lib/python3.9/site-packages/airflow/providers/postgres/hooks/postgres.py",
 line 113, in get_conn self.conn = psycopg2.connect(**conn_args) which does not 
have client_type removed as a connection parameter. The code should rather 
behave like this:
   ```
           for arg_name, arg_val in conn.extra_dejson.items():
               if arg_name not in [
                   "iam",
                   "redshift",
                   "cursor",
                   "cluster-identifier",
                   "aws_conn_id",
                   "client_type",
               ]:
                   conn_args[arg_name] = arg_val
   ```
   
   
   ### Use case/motivation
   
   Error logs should go away in the DAG Airflow logs:
   ```
   Traceback (most recent call last):
     File 
"/usr/local/lib/python3.9/site-packages/openlineage/airflow/extractors/manager.py",
 line 48, in extract_metadata
       task_metadata = extractor.extract()
     File 
"/usr/local/lib/python3.9/site-packages/openlineage/airflow/extractors/sql_extractor.py",
 line 62, in extract
       inputs, outputs = get_table_schemas(
     File 
"/usr/local/lib/python3.9/site-packages/openlineage/airflow/extractors/dbapi_utils.py",
 line 44, in get_table_schemas
       with closing(hook.get_conn()) as conn:
     File 
"/usr/local/lib/python3.9/site-packages/airflow/providers/postgres/hooks/postgres.py",
 line 113, in get_conn
       self.conn = psycopg2.connect(**conn_args)
     File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 
121, in connect
       dsn = _ext.make_dsn(dsn, **kwargs)
     File "/usr/local/lib/python3.9/site-packages/psycopg2/extensions.py", line 
167, in make_dsn
       parse_dsn(dsn)
   psycopg2.ProgrammingError: invalid dsn: invalid connection option 
"client_type"
   ```
   
   ### 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