Skip to content

Conversation

@jroachgolf84
Copy link
Collaborator

To match the behavior in the SFTPOperator, the create_intermediate_dirs parameter was added to the GCSToSFTPOperator. If this is False, then the file will be copied/moved with running the SFTPHook.create_directory() method. An SFTP user may have permissions to copy/move a file, but not create a new directory. This resulted in PermissionError's. Per the original issue:

The goal is to upload files from GCS to SFTP reliably even when the target folder exists and directory creation permissions are restricted. This prevents PermissionError failures and makes GCSToSFTPOperator more consistent with other SFTP operators.

closes: #54906

@boring-cyborg boring-cyborg bot added area:providers provider:google Google (including GCP) related issues labels Aug 25, 2025
@jroachgolf84 jroachgolf84 marked this pull request as draft August 25, 2025 13:57
@jroachgolf84 jroachgolf84 marked this pull request as ready for review August 25, 2025 19:48
Copy link
Contributor

@VladaZakharova VladaZakharova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there!
Thank you for PR, I have only one question:
Does this option cover cases when we have several folders as a tree of directories? like folder1/folder2/file.txt? will it create both folders if this parameters will be True?
Do we cover those cases in unit tests?

@jroachgolf84
Copy link
Collaborator Author

@VladaZakharova - yes, these cases are covered by the rest of the unit-tests for this Operator.

@potiuk potiuk merged commit 36d057f into apache:main Aug 26, 2025
77 checks passed
mangal-vairalkar pushed a commit to mangal-vairalkar/airflow that referenced this pull request Aug 30, 2025
…54916)

* Adding create_intermediate_dirs to determine if intemediate directories should be created

* Isolating tests for create_intermediate_dirs
nothingmin pushed a commit to nothingmin/airflow that referenced this pull request Sep 2, 2025
…54916)

* Adding create_intermediate_dirs to determine if intemediate directories should be created

* Isolating tests for create_intermediate_dirs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add create_intermediate_dirs option to GCSToSFTPOperator

3 participants