Lee-W commented on code in PR #52700:
URL: https://github.com/apache/airflow/pull/52700#discussion_r2253843516
##########
providers/sftp/src/airflow/providers/sftp/hooks/sftp.py:
##########
@@ -45,6 +49,32 @@
from airflow.models.connection import Connection
+exclude_methods = [
+ "__init__",
+ "get_ui_field_behaviour",
+ "get_conn",
+ "close_conn",
+ "get_managed_conn",
+ "get_conn_count",
+] # exclude the methods which are not using the connection, so that we won't
create a
+# connection when not needed, i.e init
Review Comment:
```suggestion
```
looks like it's no longer needed
##########
providers/sftp/src/airflow/providers/sftp/hooks/sftp.py:
##########
@@ -45,6 +49,32 @@
from airflow.models.connection import Connection
+exclude_methods = [
+ "__init__",
+ "get_ui_field_behaviour",
+ "get_conn",
+ "close_conn",
+ "get_managed_conn",
+ "get_conn_count",
+] # exclude the methods which are not using the connection, so that we won't
create a
+# connection when not needed, i.e init
+
+
+def handle_connection_management_decorator(func):
Review Comment:
```suggestion
def handle_managed_connection(func):
```
##########
providers/sftp/src/airflow/providers/sftp/hooks/sftp.py:
##########
@@ -72,6 +102,9 @@ class SFTPHook(SSHHook):
default_conn_name = "sftp_default"
conn_type = "sftp"
hook_name = "SFTP"
+ CONNECTION_NOT_OPEN_EXCEPTION: ConnectionNotOpenedException =
ConnectionNotOpenedException(
Review Comment:
We could move it to the decorator
##########
providers/sftp/src/airflow/providers/sftp/hooks/sftp.py:
##########
@@ -45,6 +49,32 @@
from airflow.models.connection import Connection
+exclude_methods = [
+ "__init__",
+ "get_ui_field_behaviour",
+ "get_conn",
+ "close_conn",
+ "get_managed_conn",
+ "get_conn_count",
+] # exclude the methods which are not using the connection, so that we won't
create a
+# connection when not needed, i.e init
+
+
+def handle_connection_management_decorator(func):
Review Comment:
We probably could use `functools.wrap` here
--
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]