Brunda10 commented on code in PR #54597:
URL: https://github.com/apache/airflow/pull/54597#discussion_r2309558110
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/variables.py:
##########
@@ -141,26 +144,18 @@ def patch_variable(
raise HTTPException(
status.HTTP_400_BAD_REQUEST, "Invalid body, key from request body
doesn't match uri parameter"
)
- non_update_fields = {"key"}
variable =
session.scalar(select(Variable).filter_by(key=variable_key).limit(1))
if not variable:
raise HTTPException(
status.HTTP_404_NOT_FOUND, f"The Variable with key:
`{variable_key}` was not found"
)
- fields_to_update = patch_body.model_fields_set
- if update_mask:
- fields_to_update = fields_to_update.intersection(update_mask)
- else:
- try:
- VariableBody(**patch_body.model_dump())
- except ValidationError as e:
- raise RequestValidationError(errors=e.errors())
-
- data = patch_body.model_dump(include=fields_to_update - non_update_fields,
by_alias=True)
+ try:
+ VariableBody(**patch_body.model_dump())
Review Comment:
Thanks for the suggestion . I’ve updated the latest commit to consolidate
the logic into update_orm_from_pydantic similar to Pool, so now both the single
patch variable endpoint and the bulk actions reuse it.
--
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]