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

adapter compability messaging added. #4565

Merged
merged 5 commits into from
Feb 3, 2022

Conversation

nkyuray
Copy link
Contributor

@nkyuray nkyuray commented Jan 11, 2022

Description

adapter compatibility messaging added.
#4438 (comment)

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change

@ChenyuLInx
Copy link
Contributor

Hey @nkyuray, thanks for contributing this! I will have more bandwidth to test this next Tuesday

Comment on lines 57 to 58
plugin_update_msg = (" To update dbt-{} please run:\n"
" pip install dbt-{} --upgrade\n\n".format(plugin_name, plugin_name))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the really actionable feedback here! My only comment is that not all users install dbt via pip - I really like the idea of making the instructions easy, but it'd be confusing to give pip instructions to someone who installed dbt via Homebrew etc.

Not sure how to square that circle; perhaps we have to fall back to linking them to the docs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the pip message is provided as an example in the original feature request. But I agree with @joellabes 's fallback to docs idea here. It would make later updates easier also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ChenyuLInx @joellabes

Ok, then simply we need to put a link of related docs page, right?
Besides the yellow one will be added also.

Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be perfect! Thanks @nkyuray

@ChenyuLInx
Copy link
Contributor

@nkyuray One more thing, don't forget to add yourself to the changelog. So we can give you credit on the release note(we are looking for ways to automate this, but right now you have to do it manually). Here's a example.

@ChenyuLInx
Copy link
Contributor

@nkyuray, we are thinking of getting this into the 1.0.2 release that aims to have an rc version later next week. We think more folks would appreciate and benefit from what you are adding here! Do you think you get time to work on it before that? If not we can either merge this in and leave the rest as an improvement or I am happy to update it a bit if you are okay with it!

@nkyuray
Copy link
Contributor Author

nkyuray commented Jan 26, 2022

Hi @ChenyuLInx,

Sorry I couldn't take time to work on this, but I will probably finalize it on Friday.
Thanks.

@ChenyuLInx
Copy link
Contributor

Hi @ChenyuLInx,

Sorry I couldn't take time to work on this, but I will probably finalize it on Friday. Thanks.

Hi @nkyuray, please don't say sorry. Thank you so much for contributing this!!

@nkyuray nkyuray requested a review from a team as a code owner January 30, 2022 17:45
@nkyuray nkyuray requested review from leahwicz and removed request for a team January 30, 2022 17:45
@cla-bot cla-bot bot added the cla:yes label Jan 30, 2022
Copy link
Contributor

@ChenyuLInx ChenyuLInx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great except for one minor part that needs to be adjusted. Thanks for pushing this on the weekend!!!

compatibility_msg = green('Up to date!')
else:
if installed.major == plugin_version.major:
compatibility_msg = yellow('Update available!')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we also need to check whether a new version of the package is actually available? I just tested locally, and because my dbt-core is 1.0.1, but the latest dbt-snowflake is only 1.0.0, I will always get this warning even though there's no newer dbt-snowflake package. I would just make the check above to be checking major and minor versions only instead of the whole version since we don't always release the patch version of the adaptors when we release dbt-core.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed! I think we could take one of two approaches here:

  • Compare {major}.{minor} only, to ensure that the plugin version is compatible with the dbt-core version
  • Run PyPi requests for each installed plugin, to see what its latest available version is

In the future we'd want a combination of both, right? Goal being to say whether installed plugins are Latest compatible with the installed dbt-core version

core/dbt/version.py Outdated Show resolved Hide resolved
@ChenyuLInx
Copy link
Contributor

I just run the tests and noticed a few minor flake8 checks failed. Currently, you have to run it by yourself. We are going to have some tutorial on getting this into your pre-commit hooks soon.

@jtcohen6
Copy link
Contributor

jtcohen6 commented Feb 3, 2022

I just run the tests and noticed a few minor flake8 checks failed. Currently, you have to run it by yourself. We are going to have some tutorial on getting this into your pre-commit hooks soon.

Per CI run, it looks like the flake8 failures are just:

core/dbt/version.py:62:100: E501 line too long (110 > 99 characters)
core/dbt/version.py:65:100: E501 line too long (103 > 99 characters)

Copy link
Contributor

@ChenyuLInx ChenyuLInx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated compare and added pulling from PYPI. @nkyuray Thank you so much for doing this!!! Sorry we really want this change in 1.0.2 so I just changed it a bit myself.

@ChenyuLInx ChenyuLInx merged commit f3c7b6b into dbt-labs:main Feb 3, 2022
ChenyuLInx added a commit that referenced this pull request Feb 3, 2022
* adapter compability messaging added.

* edited plugin version compatibility message

* edited test version for plugin compability

* compare using only major and minor

* Add checking PYPI and update changelog

Co-authored-by: Chenyu Li <chenyulee777@gmail.com>
Co-authored-by: ChenyuLi <chenyu.li@dbtlabs.com>
Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great change! Thank you @nkyuray for the contribution, and @ChenyuLInx for seeing this through.

I think there are a few small intricacies that may require us to revisit this logic in the future. I left two comments with edge cases that come to mind. If those seem like quick fixes, all the better. In either case, I'm happy to move forward with the current logic for v1.0.2rc1.

Comment on lines +58 to +60
if installed == plugin_version or (
latest_plugin_version and plugin_version == latest_plugin_version
):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible that plugins will put out patch releases before dbt-core puts out a patch release. Imagine:

  • dbt-core==1.0.1 and dbt-synapse==1.0.2 are both available
  • I have dbt-synapse==1.0.1 installed locally
  • installed == plugin_version will return True, at the same time, there's a compatible plugin update available

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realize this case, and the rule in the next comment, I will open a new issue and get these changes in

compatibility_msg = green('Up to date!')
else:
if latest_plugin_version:
if installed.major == plugin_version.major:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dbt-core + plugins are compatible at the minor-version level. So I think this might want to be:

Suggested change
if installed.major == plugin_version.major:
if installed.minor == plugin_version.minor:

If installed.minor != plugin_version.minor, we'd want to raise red('Not compatible!')

ChenyuLInx added a commit that referenced this pull request Feb 4, 2022
* adapter compability messaging added. (#4565)

* adapter compability messaging added.

* edited plugin version compatibility message

* edited test version for plugin compability

* compare using only major and minor

* Add checking PYPI and update changelog

Co-authored-by: Chenyu Li <chenyulee777@gmail.com>
Co-authored-by: ChenyuLi <chenyu.li@dbtlabs.com>

* fix changelog

* fix changelog

Co-authored-by: nkyuray <95860273+nkyuray@users.noreply.github.com>
iknox-fa pushed a commit that referenced this pull request Feb 8, 2022
* adapter compability messaging added.

* edited plugin version compatibility message

* edited test version for plugin compability

* compare using only major and minor

* Add checking PYPI and update changelog

Co-authored-by: Chenyu Li <chenyulee777@gmail.com>
Co-authored-by: ChenyuLi <chenyu.li@dbtlabs.com>

automatic commit by git-black, original commits:
  f3c7b6b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants