Skip to content

AttributeError: 'SFTPHook' object has no attribute 'close_conn' #47201

@shubham4315

Description

@shubham4315

Apache Airflow Provider(s)

sftp

Versions of Apache Airflow Providers

The latest version of apache-airflow-providers-sftp (5.1.0) has encountered an issue due to the removal of the close_conn() function in a recent commit.(fbd19da#diff-d12bfdf9541f6eaf52829b1040a95cc70d8e91a78d3eebe2771232d8ba5d7888L102-L106)

Image

The SFTP sensor continues to invoke the close_conn() function, resulting in an error.(https://github.com/apache/airflow/blob/main/providers/sftp/src/airflow/providers/sftp/sensors/sftp.py#L132)

PS:
I have just downgraded the package to version 5.0.0, and it is functioning properly.

Apache Airflow version

2.9.1

Operating System

linux

Deployment

Google Cloud Composer

Deployment details

No response

What happened

No response

What you think should happen instead

No response

How to reproduce

Install apache-airflow-providers-sftp 5.1.0

`

from airflow.models import DAG
from airflow.providers.sftp.sensors.sftp import SFTPSensor
from airflow.operators.empty import EmptyOperator
from airflow.providers.sftp.operators.sftp import SFTPOperator

with DAG(
"airflow_file_trigger_poc",
schedule_interval=None
) as dag:

start_task = EmptyOperator(
    task_id="start-task"
)

wait_for_file = SFTPSensor(
    sftp_conn_id="XYZ_SFTP",
    path="feed/test.csv",
    task_id="check-for-file",
    poke_interval=10
)

end_task = EmptyOperator(
    task_id="end-task"
)

start_task >> wait_for_file >> end_task

`

If you run this, you will find the error.

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions