SFTP Sensor¶
Looks for either a specific file or files with a specific pattern in a server using SFTP protocol.
To get more information about this sensor visit SFTPSensor
sftp_with_operator = SFTPSensor(task_id="sftp_operator", path=FULL_FILE_PATH, poke_interval=10)
We can also use Taskflow API. It takes the same arguments as the SFTPSensor
along with -
- op_args (optional)
A list of positional arguments that will get unpacked when calling your callable (templated)
- op_kwargs (optional)
A dictionary of keyword arguments that will get unpacked in your function (templated)
Whatever returned by the python callable is put into XCom.
@task.sftp_sensor( # type: ignore[attr-defined]
task_id="sftp_sensor", # type: ignore[attr-defined]
path=FULL_FILE_PATH,
poke_interval=10,
)
def sftp_sensor_decorator():
print("Files were successfully found!")
# add your logic
return "done"