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


##########
providers/google/src/airflow/providers/google/cloud/transfers/sheets_to_gcs.py:
##########
@@ -128,7 +143,11 @@ def execute(self, context: Context):
         for sheet_range in sheet_titles:
             data = sheet_hook.get_values(spreadsheet_id=self.spreadsheet_id, 
range_=sheet_range)
             gcs_path_to_file = self._upload_data(gcs_hook, sheet_hook, 
sheet_range, data)
-            destination_array.append(gcs_path_to_file)
+            gcs_uri = f"gs://{self.destination_bucket}/{gcs_path_to_file}"
+            destination_array.append(gcs_uri)
 
         context["ti"].xcom_push(key="destination_objects", 
value=destination_array)
+
+        if self.unwrap_single:
+            return destination_array[0] if len(destination_array) == 1 else 
destination_array
         return destination_array

Review Comment:
   We should handle this operator differently - it already returns a list, but 
the entities are not in the gs URI format. Therefore:
    1. There's no need for the `unwarp_single` flag - the idea is that after 
aligning the operators to return `list[str]` by default, we could then 
deprecate the `unwrap_single` where used and then users will access the single 
results using `lst[0]` only.
    2. Instead, we should introduce another flag called `return_gcs_uris` (see 
comment here: 
https://github.com/apache/airflow/pull/61048#issuecomment-3831876564) - so we 
won't break backward-compatibility with current behavior. Default should be as 
it is today (`False`), and the warning should be that it will later be changed 
to `True` - you could use the wording from #61048.



##########
providers/google/src/airflow/providers/google/cloud/transfers/gdrive_to_gcs.py:
##########
@@ -100,6 +115,13 @@ def execute(self, context: Context):
         ) as file:
             gdrive_hook.download_file(file_id=file_metadata["id"], 
file_handle=file)
 
+        gcs_uri = f"gs://{self.bucket_name}/{self.object_name}"
+        result = [gcs_uri]
+
+        if self.unwrap_single:
+            return result[0]
+        return result

Review Comment:
   See my comment for the other operator - we could avoid adding 
`unwrap_single` here at all, and just `return [gcs_uri]`.



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