-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Re-added close_conn connection on SFTPHook and get_conn should return SFTPClient instead of context managed connection #47217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…tead of context manager for backward compatibility
…egated method use the context manager which take care of closing the connection
…thod anymore and test this behaviour
|
nice! thanks! |
|
I've called the context managed connection get_sftp_conn, but I'm not happy with that name so I asked ChatGPT what would be an appropriate name for the context managed connection method: Option 1: connect() ✅ Simple and intuitive Option 2: get_managed_conn() ✅ Clearly indicates that it manages the connection lifecycle Option 3: use_conn() ✅ Short and easy to read What do you guys think? I would tend to choose option 2 or 3, as 3 could already be used I think and is confusing in my opinion. |
|
2 is good |
… SFTPClient instead of context managed connection (apache#47217) * fix: SFTPHook.get_conn method should return SFTPClient connection instead of context manager for backward compatibility * fix: SFTPSensor doesn't need to call the close_conn method as the delegated method use the context manager which take care of closing the connection * refactor: Make sure SFTPSensor doesn't need to call the close_conn method anymore and test this behaviour * refactor: Renamed get_sftp_conn method of SFTPHook to use_conn * refactor: Renamed use_conn method of SFTPHook to get_managed_conn --------- Co-authored-by: David Blain <david.blain@infrabel.be>
closes: #47129
closes: #47201
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.