Airflow SFTPToGCSOperator sftp file exist check #41479
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a fail_on_sftp_file_not_exist parameter to the
SFTPToGCSOperator, allowing users to configure whether the task should fail or continue when the specified file is not found on the SFTP server.Description
This PR introduces a new parameter,
fail_on_sftp_file_not_exist, to theSFTPToGCSOperator. This parameter allows users to specify whether the operator should fail the task if the specified file is not found on the SFTP server.Previously, the operator would raise an exception and fail the task if the file was not found on the SFTP server. With the introduction of the
fail_on_sftp_file_not_existparameter, users now have the flexibility to configure the operator's behavior in such scenarios. By setting this parameter toFalse, the operator will log a warning message instead of failing the task, allowing the DAG to continue running.This enhancement aligns with similar improvements requested for other operators, such as the
SFTPToS3Operator.Changes
fail_on_sftp_file_not_existparameter to theSFTPToGCSOperator._copy_single_objectmethod to conditionally handle missing files based on the value offail_on_sftp_file_not_exist.