dbt-labs / dbt-core

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
https://getdbt.com
Apache License 2.0
9.9k stars 1.63k forks source link

[CT-2174] [Regression] Package max version range throwing error #7039

Closed fivetran-joemarkiewicz closed 1 year ago

fivetran-joemarkiewicz commented 1 year ago

Is this a regression in a recent version of dbt-core?

Current Behavior

On the latest 1.4.2 version of dbt-core when installing a dbt package with the range including a range with a max of 0.10.0 you will receive an erroneous failure. For example:

packages:
   - package: fivetran/google_ads_source
     version: [">=0.9.0", "<0.10.0"]

Will result in

Version error for package fivetran/google_ads_source: Could not find a satisfactory version from options: ['>=0.9.0', '<0.10.0']

However, the latest version of fivetran/google_ads is 0.9.0 and should be fine with that version range.

If I then adjust the range to just not include 0.10.0 it will succeed:

packages:
   - package: fivetran/google_ads_source
     version: [">=0.9.0", "<0.9.9"]

Result

22:28:23  Installing fivetran/google_ads_source
22:28:24    Installed from version 0.9.0
22:28:24    Up to date!

Expected/Previous Behavior

The range would succeed with 0.10.0.

Steps To Reproduce

  1. Install the google_ads_source package with the following range
packages:
   - package: fivetran/google_ads_source
     version: [">=0.9.0", "<0.10.0"]
  1. Run dbt deps
  2. See the following error:
    Version error for package fivetran/google_ads_source: Could not find a satisfactory version from options: ['>=0.9.0', '<0.10.0']

Relevant log output

Version error for package fivetran/google_ads_source: Could not find a satisfactory version from options: ['>=0.9.0', '<0.10.0']

Environment

- OS: Mac OS
- Python: 3.9.6
- dbt (working version): 1.4.1
- dbt (regression version): 1.4.2

Which database adapter are you using with dbt?

bigquery

Additional Context

Here is a slack thread where a user experienced a similar issue when trying to install the fivetran/ad_reporting package.

jtcohen6 commented 1 year ago

@fivetran-joemarkiewicz Thanks for opening!

I'm guessing this must be related somehow to the change in https://github.com/dbt-labs/dbt-core/pull/6838. Taking a look

jtcohen6 commented 1 year ago

https://github.com/dbt-labs/dbt-core/blob/5ddd40885e0502e968fd2633127cbb7a1959a40f/core/dbt/semver.py#L154-L158

Drop a breakpoint after line 154:

            else:  # major/minor/patch, should all be numbers
                if key == "minor":
                    first = a
                    second = b
                    import ipdb; ipdb.set_trace()
ipdb> first
'9'
ipdb> second
'10'
ipdb> first > second
True

should all be numbers

let's make sure of it :)

fivetran-joemarkiewicz commented 1 year ago

Brilliant, @jtcohen6 thanks for working so quickly to address this! 🎉