uranusjr commented on code in PR #34791:
URL: https://github.com/apache/airflow/pull/34791#discussion_r1363544598


##########
tests/cli/commands/test_variable_command.py:
##########
@@ -49,6 +49,15 @@ def test_variables_set(self):
         with pytest.raises(KeyError):
             Variable.get("foo1")
 
+    def test_variables_set_with_description(self):
+        """Test variable_set command with optional description argument"""
+        variable_command.variables_set(
+            self.parser.parse_args(["variables", "set", "foo", "bar", 
"--description", "foo_bar_description"])
+        )
+        assert Variable.get("foo") is not None

Review Comment:
   It’s not in the public API, but you can do this with SQLalchemy:
   
   ```python
   with create_session() as session:
       desc = session.scalar(select(Variable.description).where(Variable.key == 
"foo"))
   ```
   
   This is (more or less) what the web UI does to retrieve the value.



##########
tests/cli/commands/test_variable_command.py:
##########
@@ -49,6 +49,15 @@ def test_variables_set(self):
         with pytest.raises(KeyError):
             Variable.get("foo1")
 
+    def test_variables_set_with_description(self):
+        """Test variable_set command with optional description argument"""
+        variable_command.variables_set(
+            self.parser.parse_args(["variables", "set", "foo", "bar", 
"--description", "foo_bar_description"])
+        )
+        assert Variable.get("foo") is not None

Review Comment:
   It’s not in the public API, but you can do this with SQLalchemy:
   
   ```python
   with create_session() as session:
       desc = session.scalar(select(Variable.description).where(Variable.key == 
"foo"))
   ```
   
   This is (more or less) what the web UI does to retrieve the value.



-- 
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: commits-unsubscr...@airflow.apache.org

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

Reply via email to