You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/05/04 10:16:58 UTC

[GitHub] [airflow] natanweinberger commented on a change in pull request #15425: Fix CLI connections import

natanweinberger commented on a change in pull request #15425:
URL: https://github.com/apache/airflow/pull/15425#discussion_r625666374



##########
File path: airflow/models/connection.py
##########
@@ -364,3 +364,14 @@ def get_connection_from_secrets(cls, conn_id: str) -> 'Connection':
             if conn:
                 return conn
         raise AirflowNotFoundException(f"The conn_id `{conn_id}` isn't defined")
+
+    @classmethod
+    def from_dict(cls, conn_dict: Dict) -> 'Connection':
+        """
+        Create a connection from a dictionary.
+
+        :param conn_dict: dictionary representing a connection's attributes
+            e.g., {'conn_id': '', 'conn_type': '', 'login': '', ...}
+        :return: connection
+        """
+        return Connection(**conn_dict)

Review comment:
       Sure, will do.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org