shahar1 commented on code in PR #73434:
URL: https://github.com/apache/airflow/pull/73434#discussion_r4060762449


##########
providers/google/src/airflow/providers/google/cloud/operators/stackdriver.py:
##########
@@ -147,7 +146,9 @@ def execute(self, context: Context):
             context=context,
             project_id=self.project_id or self.hook.project_id,
         )
-        return [AlertPolicy.to_dict(policy) for policy in result]
+        if self.format_ is None:

Review Comment:
   The hook branches on the *value* of `format_`, not on whether it is set: 
`"dict"` returns dictionaries, `"json"` returns JSON strings, and **anything 
else** falls through to `return policies_` — the raw protobuf pager.
   
   So with e.g. `format_="Dict"` (a typo) or `format_="protobuf"` (which the 
old docstring arguably invited), this now returns the pager straight to XCom, 
where it isn't serializable — before this change it was converted to 
dictionaries. Mirroring the hook's own branch keeps every input XCom-safe:
   
   ```suggestion
           if self.format_ not in ("dict", "json"):
   ```
   



##########
providers/google/src/airflow/providers/google/cloud/operators/stackdriver.py:
##########
@@ -578,7 +578,9 @@ def execute(self, context: Context):
             context=context,
             project_id=self.project_id or self.hook.project_id,
         )
-        return [NotificationChannel.to_dict(channel) for channel in channels]
+        if self.format_ is None:

Review Comment:
   Same as above for the notification-channels operator: the hook falls through 
to the protobuf pager for any `format_` that isn't `"dict"` or `"json"`, so 
this returns a non-XCom-serializable pager where the old code returned 
dictionaries.
   
   ```suggestion
           if self.format_ not in ("dict", "json"):
   ```
   



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