Skip to content

Undocumented breaking change in SFTPHook in airflow-providers-sftp 5.1.0 release #47129

@agreenburg

Description

@agreenburg

Apache Airflow Provider(s)

sftp

Versions of Apache Airflow Providers

apache-airflow-providers-sftp 5.1.0

Apache Airflow version

2.10.4+astro.1

Operating System

Astronomer Runtime 12.6.0

Deployment

Astronomer

Deployment details

No response

What happened

We have python operator code that expects SFTPHook.get_conn() to return a paramiko.SFTPClient instance.

In 5.1.0 this code was changed to return Generator[SFTPClient] instead. This is causing this existing code to fail:

conn = sftpHook.get_conn()
conn.listdir_attr(remoteRootDir)

with this error:

AttributeError: '_GeneratorContextManager' object has no attribute 'listdir_attr'

Reverting to version 5.0.0 allows the code to run as before.

What you think should happen instead

Breaking changes should be documented in the changelog.

How to reproduce

conn = sftpHook.get_conn()
conn.listdir_attr(remoteRootDir)

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