Taragolis commented on code in PR #39788:
URL: https://github.com/apache/airflow/pull/39788#discussion_r1613189149


##########
airflow/providers/opensearch/hooks/opensearch.py:
##########
@@ -40,15 +46,49 @@ class OpenSearchHook(BaseHook):
     conn_type = "opensearch"
     hook_name = "OpenSearch Hook"
 
-    def __init__(self, open_search_conn_id: str, log_query: bool, **kwargs: 
Any):
+    def __init__(
+        self,
+        open_search_conn_id: str,
+        log_query: bool,
+        open_search_conn_class: str = "RequestsHttpConnection",

Review Comment:
   And also need add information about new attribute in docstrings



##########
airflow/providers/opensearch/hooks/opensearch.py:
##########
@@ -40,15 +46,49 @@ class OpenSearchHook(BaseHook):
     conn_type = "opensearch"
     hook_name = "OpenSearch Hook"
 
-    def __init__(self, open_search_conn_id: str, log_query: bool, **kwargs: 
Any):
+    def __init__(
+        self,
+        open_search_conn_id: str,
+        log_query: bool,
+        open_search_conn_class: str = "RequestsHttpConnection",

Review Comment:
   I don't think we need to use such complicated logic with dynamic imports, we 
could just provide class as is into the hook/operator
   
   ```python
   from typing import Any, TYPE_CHECKING
   
   if TYPE_CHECKING:
       from opensearchpy import Connection as OpenSearchConnectionClass
   
   class OpenSearchHook(BaseHook):
       def __init__(
           ...
           open_search_conn_class: type[OpenSearchConnectionClass] | None = 
None,
   ```



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