GoogleCalendarToGCSOperator: add unwrap_single flag and return full GCS URIs#61284
GoogleCalendarToGCSOperator: add unwrap_single flag and return full GCS URIs#61284shahar1 merged 20 commits intoapache:mainfrom
Conversation
There was a problem hiding this comment.
- Please read my edit to the original issue regarding handling of single entities - we should have a flag for returning a list of strings (
unwrap_single). - Please add unit tests.
- Before creating new PRs related to this issue, please ask for assignment in the original issue (I've assigned you for these two operators - but please consider it for the next times).
I've made changes accordingly , please review and let me know if anything else is required |
…_unwrap_single_false test
shahar1
left a comment
There was a problem hiding this comment.
Looks better, a couple of comments to resolve before we're ready to go
providers/google/tests/unit/google/cloud/transfers/test_calendar_to_gcs.py
Outdated
Show resolved
Hide resolved
providers/google/tests/unit/google/marketing_platform/operators/test_display_video.py
Outdated
Show resolved
Hide resolved
providers/google/src/airflow/providers/google/marketing_platform/operators/display_video.py
Outdated
Show resolved
Hide resolved
providers/google/src/airflow/providers/google/cloud/transfers/calendar_to_gcs.py
Show resolved
Hide resolved
providers/google/src/airflow/providers/google/cloud/transfers/calendar_to_gcs.py
Show resolved
Hide resolved
providers/google/src/airflow/providers/google/cloud/transfers/calendar_to_gcs.py
Outdated
Show resolved
Hide resolved
providers/google/src/airflow/providers/google/cloud/transfers/calendar_to_gcs.py
Outdated
Show resolved
Hide resolved
providers/google/src/airflow/providers/google/marketing_platform/operators/display_video.py
Outdated
Show resolved
Hide resolved
providers/google/src/airflow/providers/google/marketing_platform/operators/display_video.py
Outdated
Show resolved
Hide resolved
providers/google/tests/unit/google/marketing_platform/operators/test_display_video.py
Outdated
Show resolved
Hide resolved
shahar1
left a comment
There was a problem hiding this comment.
Please handle these last changes and I'll aprove
providers/google/src/airflow/providers/google/cloud/transfers/calendar_to_gcs.py
Outdated
Show resolved
Hide resolved
providers/google/src/airflow/providers/google/marketing_platform/operators/display_video.py
Outdated
Show resolved
Hide resolved
providers/google/src/airflow/providers/google/cloud/transfers/calendar_to_gcs.py
Outdated
Show resolved
Hide resolved
|
@Ajay9704 One last thing (half related) - it seems that some of the tests are written using Python's native unittest module, instead of pytest. I'll carefully assume that it is due to the usage of AI, which is not forbidden - but it should be supervised and declared explicitly in the PR's description. Please refer to the related docs and note for your next PRs. |
966a548 to
dc37d27
Compare
Sorry sir, while resolving I got stuck at one point, so I took help from AI. I will remember this and won’t do it again, and even if I take a small help next time, I will mention it in the PR I have updated PR description accordingly |
|
@shahar1 i am unable to understand what went wrong can you please help me with this
|
Sure! I tried to rerun it - it doesn't seem related to this PR specifically, so it's either a flaky integration test or something else that should be solved by merging from main. |
Sure sir, and thank you for helping throughout |
Seems to pass succesfully :) |
…erator - Add unwrap_single keyword-only parameter to __init__ (default=False) - Update execute() return type to str | list[str] - Implement conditional return logic: - Returns str when unwrap_single=True - Returns list[str] by default (backward compatible) - Add comprehensive docstring updates - Add test_execute_with_unwrap_single() to validate new behavior - Maintain backward compatibility with existing code Follows the pattern used in PR apache#61284
4041732 to
9c4fe04
Compare
|
Are you able to run the system tests for the changes operators? Google team asks to do that before merging to ensure that they still pass after making changes. |
…erator - Add unwrap_single keyword-only parameter to __init__ (default=False) - Update execute() return type to str | list[str] - Implement conditional return logic: - Returns str when unwrap_single=True - Returns list[str] by default (backward compatible) - Add comprehensive docstring updates - Add test_execute_with_unwrap_single() to validate new behavior - Maintain backward compatibility with existing code Follows the pattern used in PR apache#61284
…erator - Add unwrap_single keyword-only parameter to __init__ (default=False) - Update execute() return type to str | list[str] - Implement conditional return logic: - Returns str when unwrap_single=True - Returns list[str] by default (backward compatible) - Add comprehensive docstring updates - Add test_execute_with_unwrap_single() to validate new behavior - Maintain backward compatibility with existing code Follows the pattern used in PR apache#61284
|
@shahar1 Test Screenshotsunrwap_single = True
unrwap_single = False
As for |
Thanks a lot, and good point! @Ajay9704 Until we figure out the above, could you please split the |
providers/google/src/airflow/providers/google/cloud/transfers/calendar_to_gcs.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Good job!
- I've accidentally misled you in this comment - I meant that
return_gcs_uricannot be set toFalsealtogether withunwrap_single=False(I flipped it the other way around when writing it). - Please add a deprecation warning to
return_gcs_uriparameter as well. Be careful - when checking the condition of both flags, they should bebooland notNone(otherwise you might compare withNonethat has a falsy beahvior). - Adjusts tests according to the above.
Afterwards I think that we're good to go.
providers/google/src/airflow/providers/google/cloud/transfers/calendar_to_gcs.py
Outdated
Show resolved
Hide resolved
providers/google/src/airflow/providers/google/cloud/transfers/calendar_to_gcs.py
Outdated
Show resolved
Hide resolved
providers/google/src/airflow/providers/google/cloud/transfers/calendar_to_gcs.py
Outdated
Show resolved
Hide resolved
0cf8da2 to
345f220
Compare
shahar1
left a comment
There was a problem hiding this comment.
Very last small fix and we're good to go :)
providers/google/src/airflow/providers/google/cloud/transfers/calendar_to_gcs.py
Outdated
Show resolved
Hide resolved
The requested fix has been applied, and all checks are now successful. Please review when convenient. |




I improved the return values of two Google ToGCS operators to provide full gs:// URIs instead of partial paths, making them more consistent and directly usable.
Changes made:
GoogleCalendarToGCSOperator - Now returns complete GCS URIs (e.g. gs://bucket/calendar_id.json) instead of just object names
GoogleDisplayVideo360SDFtoGCSOperator - Now returns proper GCS URIs (e.g., gs://bucket/object_name) instead of bucket/object format
These changes address part of issue #11323 by standardizing the return format to provide more useful destination URIs for users
Used AI for resolving conflicts