Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DELETE operation in SFTPOperator #46233

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Dawnpool
Copy link
Contributor

@Dawnpool Dawnpool commented Jan 29, 2025

This PR adds DELETE operation in SFTPOperator, related to the issue(#40365) I have raised before.

Currently, SFTPOperator only supports PUT and GET operations. With this update, you can now delete files or directories on a remote SFTP server by putting paths in the remote_filepath parameter.

NOTE: The local_filepath parameter does nothing in DELETE operation even if it's provided

closes: #40365

@eladkal
Copy link
Contributor

eladkal commented Jan 30, 2025

NOTE: The local_filepath parameter does nothing in DELETE operation even if it's provided

Then you need to identify this case in the code and raise exception. It's best to tell users what is not right rather then ask them to read documentation.

example:

if soft_fail is True and never_fail is True:
raise ValueError("soft_fail and never_fail are mutually exclusive, you can not provide both.")

(Don't forget to add test case to cover this case)

Alternatively, if preferred, you can just log that local_filepath was ignored (with some informative message).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve SFTPOperator with directory transfer and DELETE operation
2 participants