SameerMesiah97 commented on code in PR #66893:
URL: https://github.com/apache/airflow/pull/66893#discussion_r3243754173
##########
providers/postgres/src/airflow/providers/postgres/hooks/postgres.py:
##########
@@ -230,6 +230,29 @@ def _get_cursor(self, raw_cursor: str) -> CursorType:
valid_cursors = ", ".join(cursor_types.keys())
raise ValueError(f"Invalid cursor passed {_cursor}. Valid options are:
{valid_cursors}")
+ def _get_cursor_config(self, raw_cursor: str) -> tuple[str, Any]:
+ cursor = self._get_cursor(raw_cursor)
+
+ if USE_PSYCOPG3:
+ return "row_factory", cursor
+
+ return "cursor_factory", cursor
+
+ def _create_connection(self, conn_args: dict[str, Any]) ->
CompatConnection:
+ if USE_PSYCOPG3:
+ from psycopg.connection import Connection as pgConnection
+
+ connection = pgConnection.connect(**cast("Any", conn_args))
+
+ register_default_adapters(connection)
+
+ if self.enable_log_db_messages and hasattr(connection,
"add_notice_handler"):
+ connection.add_notice_handler(self._notice_handler)
+
+ return cast("CompatConnection", connection)
+
+ return cast("CompatConnection", ppg2_connect(**conn_args))
Review Comment:
I have removed the `cast` the from both.
--
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]