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 2020/03/28 09:06:40 UTC

[GitHub] [airflow] ashb commented on a change in pull request #7923: Get Airflow Variables from Environment Variables

ashb commented on a change in pull request #7923: Get Airflow Variables from Environment Variables
URL: https://github.com/apache/airflow/pull/7923#discussion_r399639447
 
 

 ##########
 File path: airflow/secrets/metastore.py
 ##########
 @@ -37,3 +37,16 @@ def get_connections(self, conn_id, session=None) -> List[Connection]:
         conn_list = session.query(Connection).filter(Connection.conn_id == conn_id).all()
         session.expunge_all()
         return conn_list
+
+    @provide_session
+    def get_variable(self, key: str, session=None):
+        """
+        Get Airflow Variable from Metadata DB
+
+        :param key: Variable Key
+        :return: Variable Value
+        """
+        from airflow.models.variable import Variable
 
 Review comment:
   Yeah, imports in functions are almost never circular - to be able to call the function one module already needs to be fully loaded already, so a cycle can never result.

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


With regards,
Apache Git Services