kaxil commented on a change in pull request #17935:
URL: https://github.com/apache/airflow/pull/17935#discussion_r699286648



##########
File path: airflow/providers/hashicorp/secrets/vault.py
##########
@@ -206,7 +205,12 @@ def get_conn_uri(self, conn_id: str) -> Optional[str]:
 
         return response.get("conn_uri") if response else None
 
-    def get_connection(self, conn_id: str) -> Optional[Connection]:
+    # Make sure connection is imported this way for type checking, otherwise 
when importing
+    # the backend it will get a circular dependency and fail
+    if TYPE_CHECKING:
+        from airflow.models.connection import Connection

Review comment:
       This can go at the top of the file

##########
File path: airflow/providers/hashicorp/secrets/vault.py
##########
@@ -206,7 +205,12 @@ def get_conn_uri(self, conn_id: str) -> Optional[str]:
 
         return response.get("conn_uri") if response else None
 
-    def get_connection(self, conn_id: str) -> Optional[Connection]:
+    # Make sure connection is imported this way for type checking, otherwise 
when importing
+    # the backend it will get a circular dependency and fail
+    if TYPE_CHECKING:
+        from airflow.models.connection import Connection

Review comment:
       Yeah no strong opinion on top or bottom :D -- just won't make a 
difference from code view as it is inside TYPE_CHECKING conditional




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