Skip to content

Conversation

@harsh481
Copy link
Contributor

@harsh481 harsh481 commented Sep 12, 2025

Add configurable confirm parameter to S3ToSFTPOperator

Summary

This enhancement adds a confirm parameter to the S3ToSFTPOperator to make SFTP file transfer confirmation behavior explicit and configurable, providing consistency with SFTPOperator.

Changes

  • Add confirm: bool = True parameter to S3ToSFTPOperator constructor.
  • Pass confirm parameter explicitly to Paramiko's put() method.
  • Update docstring with parameter documentation.
  • Add comprehensive unit tests for both confirm=True and confirm=False scenarios.

Motivation

  • One of the production jobs encountered an issue while dropping the file to the SFTP server using S3TOSFTPOperator. The server is configured to automatically move files to another designated directory when they are dropped at the root path.
  • Since S3ToSFTPOperator works with Paramiko’s default setting confirm=True, it calls stat() to confirm a successful file transfer, which causes the pipeline to fail.
Screenshot 2025-09-05 at 9 45 01 AM
  • This change allows users to:
    • Explicitly control confirmation behavior
    • Choose confirm=False for performance-critical scenarios
    • Have consistent API design with SFTPOperator.

Testing

  • Added unit tests verifying both confirmation scenarios.
  • All existing tests continue to pass.
  • Code passes static analysis checks.

Backward Compatibility

This change is fully backward compatible. Existing code will continue to work exactly as before since the default value confirm=True matches Paramiko's existing default behavior.

@boring-cyborg
Copy link

boring-cyborg bot commented Sep 12, 2025

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg bot added area:providers provider:amazon AWS/Amazon - related issues labels Sep 12, 2025
@harsh481 harsh481 force-pushed the fix-s3tosftp-add-confirm-parameter branch from ad669e8 to 3ea363b Compare September 12, 2025 18:19
Copy link
Contributor

@o-nikolas o-nikolas left a comment

Choose a reason for hiding this comment

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

Barring passing tests, the changes look lgtm

@harsh481
Copy link
Contributor Author

Hey @o-nikolas / @vincbeck
How do I merge these changes into the main branch?
Are there any additional steps I need to follow?

@vincbeck
Copy link
Contributor

Hey @o-nikolas / @vincbeck How do I merge these changes into the main branch? Are there any additional steps I need to follow?

Hey @harsh481 , tests are failing. Can you please take a look and fix them? Examples of failures:

ERROR providers/amazon/tests/unit/amazon/aws/transfers/test_s3_to_sftp.py::TestS3ToSFTPOperator::test_s3_to_sftp_operation_confirm_true_default - airflow.exceptions.AirflowException: SSH operator error: exit status = 1
ERROR providers/amazon/tests/unit/amazon/aws/transfers/test_s3_to_sftp.py::TestS3ToSFTPOperator::test_s3_to_sftp_operation_confirm_false - airflow.exceptions.AirflowException: SSH operator error: exit status = 1

@harsh481
Copy link
Contributor Author

Hey @o-nikolas / @vincbeck How do I merge these changes into the main branch? Are there any additional steps I need to follow?

Hey @harsh481 , tests are failing. Can you please take a look and fix them? Examples of failures:

ERROR providers/amazon/tests/unit/amazon/aws/transfers/test_s3_to_sftp.py::TestS3ToSFTPOperator::test_s3_to_sftp_operation_confirm_true_default - airflow.exceptions.AirflowException: SSH operator error: exit status = 1
ERROR providers/amazon/tests/unit/amazon/aws/transfers/test_s3_to_sftp.py::TestS3ToSFTPOperator::test_s3_to_sftp_operation_confirm_false - airflow.exceptions.AirflowException: SSH operator error: exit status = 1

Hey @vincbeck ,
Thank you for pointing out the issue in the test. I’ve fixed the SSH connection cleanup and made it consistent with test_s3_to_sftp_operation.
Here is the output of tests with latest commit changes:

  • For test_s3_to_sftp_operation_confirm_false :
Screenshot 2025-09-17 at 2 40 59 PM
  • For test_s3_to_sftp_operation_confirm_false :
Screenshot 2025-09-17 at 2 42 44 PM

@vincbeck vincbeck merged commit 1576db7 into apache:main Sep 17, 2025
147 of 148 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Sep 17, 2025

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Sep 30, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 1, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 2, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 3, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 4, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 5, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 5, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 7, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 8, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 9, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 10, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 11, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 12, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 14, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 15, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 17, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants