Skip to content
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

Remove host as an instance attr in DatabricksHook #20540

Merged
merged 1 commit into from
Dec 28, 2021

Conversation

josh-fell
Copy link
Contributor

As part of #20526, parsing logic of host was moved out of the __init__() method in DatabricksHook. With this change, host no longer needs to be an instance attribute of the hook.


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, 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 UPDATING.md.

@josh-fell
Copy link
Contributor Author

CC @dstandish

@potiuk
Copy link
Member

potiuk commented Dec 28, 2021

We can include it in the next provider's released (planned to do it tomorrow.)

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Dec 28, 2021
@github-actions
Copy link

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@dstandish
Copy link
Contributor

I like it... BUT... must we consider this a "breaking" change?

@josh-fell
Copy link
Contributor Author

I like it... BUT... must we consider this a "breaking" change?

For some historical context on this and moving the get_connection() call in and out of __init__() if it helps assist in a decision:

Quite the adventure.

@potiuk
Copy link
Member

potiuk commented Dec 28, 2021

I like it... BUT... must we consider this a "breaking" change?

Why ?

@dstandish
Copy link
Contributor

dstandish commented Dec 28, 2021

I like it... BUT... must we consider this a "breaking" change?

Why ?

Because host will no longer be set after __init__

in last release it seems instance attr host was set in __init__

this among the most marginal of changes we should consider "breaking" but if we want to be strict it probably is right to consider it so. in this case the solution should probably be to make it a cached property. but @potiuk if you think we can just chop the attr that would be best from code perspective. based on @josh-fell's analyis it seems it was only an instance attr for one release (since v2.1.0)

@potiuk
Copy link
Member

potiuk commented Dec 28, 2021

I think "behavrioural" changes like that are not "breaking". Whether self.host is an instance of variable does not change the "use" of it - at most it optimizes some behaviours - in this case the "self.host" was created in both - DagParser and Task, when it was removed, it was only created in Task (during execute).

As we discussed here: #19572 (comment) - Databricks is not really a "generic" operator that you might want to extend or dertive from to use internal features. Unlke KPO for example which is generic and it's easier to imagine that people would like to change their behaviour by extending it. So I think we can consider it's internals are really "implementation details".

Unfortunately we do not have clear-cut what is breaking and what not :(. Theoretically even adding a default parameter might be breaking because somone could overload that method in a derived class, or you could imagine someone checks signature of the method.

This is really almost always an exercise of "how likely this change is breaking" rather than "clear-cut" 0/1 breaking/non-breaking. And except some obvious cases, almost always it will have to be judged individually.

@potiuk potiuk merged commit d3b3161 into apache:main Dec 28, 2021
@dstandish
Copy link
Contributor

thanks @potiuk

@josh-fell josh-fell deleted the databricks-hook-host-attr branch December 28, 2021 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers okay to merge It's ok to merge this PR as it does not require more tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants