jason810496 commented on code in PR #71011:
URL: https://github.com/apache/airflow/pull/71011#discussion_r3726526387


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/variables.py:
##########
@@ -174,14 +174,7 @@ def post_variable(
 
     Variable.set(**post_body.model_dump(), session=session)
 
-    variable = session.scalar(select(Variable).where(Variable.key == 
post_body.key).limit(1))
-    if variable is None:
-        raise HTTPException(
-            status.HTTP_404_NOT_FOUND,
-            f"Variable with key: `{post_body.key}` was not found",
-        )
-
-    return variable
+    return session.scalar(select(Variable).where(Variable.key == 
post_body.key).limit(1))

Review Comment:
   It's a safe guard introduced in 
https://github.com/apache/airflow/commit/da7519c2b2f3bb16605e735cfa0adf54b2c2fa3d
 to fix the Mypy warning.
   
   IMO, It's fine to remove it but better in other PR instead of coupling in 
this one.



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