shahar1 commented on code in PR #61284:
URL: https://github.com/apache/airflow/pull/61284#discussion_r2788543777
##########
providers/google/src/airflow/providers/google/cloud/transfers/calendar_to_gcs.py:
##########
@@ -75,6 +75,11 @@ class GoogleCalendarToGCSOperator(BaseOperator):
If set as a sequence, the identities from the list must grant
Service Account Token Creator IAM role to the directly preceding
identity, with first
account from the list granting this role to the originating account
(templated).
+ :param unwrap_single: If True (default), returns a single URI string when
there's only one file.
+ If False, always returns a list of URIs. Default will change to False
in a future release.
+ :param return_gcs_uri: If True, returns the full GCS URI (e.g.,
``gs://bucket/path/to/file``).
+ If False (default), returns the destination file name only (e.g.,
``bucket/path/to/file``).
+ This parameter cannot be used together with ``unwrap_single=True``.
Review Comment:
```suggestion
When this parameter's value is false, it cannot be used altogether
with ``unwrap_single=False``.
```
##########
providers/google/src/airflow/providers/google/cloud/transfers/calendar_to_gcs.py:
##########
@@ -132,11 +139,32 @@ def __init__(
self.destination_bucket = destination_bucket
self.destination_path = destination_path
self.impersonation_chain = impersonation_chain
+ if unwrap_single is None:
+ self.unwrap_single = True
+ import warnings
+
+ warnings.warn(
+ "The default value of unwrap_single will change from True to
False in a future release. "
+ "Please set unwrap_single explicitly to avoid this warning.",
+ FutureWarning,
+ stacklevel=2,
+ )
+ else:
+ self.unwrap_single = unwrap_single
+
+ self.return_gcs_uri = return_gcs_uri
+
+ if self.unwrap_single and self.return_gcs_uri:
+ raise ValueError(
+ "return_gcs_uri cannot be True together with
unwrap_single=True. "
+ "In the future, all operators will return list of URIs, so
please set "
+ "unwrap_single=False when using return_gcs_uri=True."
+ )
Review Comment:
```suggestion
if not self.unwrap_single and not self.return_gcs_uri:
raise ValueError(
"return_gcs_uri cannot be False together with
unwrap_single=False. "
"In the future, all operators will return list of URIs, so
please set "
"unwrap_single=False when using return_gcs_uri=True."
)
```
##########
providers/google/src/airflow/providers/google/cloud/transfers/calendar_to_gcs.py:
##########
@@ -108,6 +113,8 @@ def __init__(
destination_path: str | None = None,
gcp_conn_id: str = "google_cloud_default",
impersonation_chain: str | Sequence[str] | None = None,
+ unwrap_single: bool | None = None,
+ return_gcs_uri: bool = False,
Review Comment:
```suggestion
return_gcs_uri: bool | None = False,
```
+ Add a similar deprecation warning to `unwrap_single` (its value will be
set to True in future release)
--
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]