vincbeck commented on code in PR #58905:
URL: https://github.com/apache/airflow/pull/58905#discussion_r2585648422


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/variables.py:
##########
@@ -62,7 +62,9 @@ def delete_variable(
     session: SessionDep,
 ):
     """Delete a variable entry."""
-    if Variable.delete(variable_key, session) == 0:
+    result = session.execute(delete(Variable).where(Variable.key == 
variable_key))
+    rows = getattr(result, "rowcount", 0) or 0
+    if rows == 0:

Review Comment:
   No, it is not related to SQLA 1 -> 2. Similarly to why the get route is NOT 
using `Variable.get`, we should not use `Variable.delete` here. 
`Variable.delete` checks if the team passed as parameter if the same as the one 
associated to the variable (if any). `Variable.delete` should only be executed 
in a task execution environment (execution API). Here, the public API, we want 
to simply delete the variable. The authorization check (whether the user is 
allowed to delete this variable) is already done by the dependency



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