Skip to content

Conversation

@Dev-iL
Copy link

@Dev-iL Dev-iL commented Feb 11, 2026

  1. What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-3066571: SQLAlchemy compat script doesn't handle versions containing letters  #646

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
    • I am adding new logging messages
    • I am adding new credentials
    • I am adding a new dependency
  3. Please describe how your code solves the related issue.

    The version string SA_VERSION can contain pre-release suffixes like 2.1.0b1, 2.0.0rc2, or 2.0.5.post1. The original code splits on "." and calls int() on each segment, which raises ValueError for segments like 0b1 or post1 that contain non-numeric characters.

    The fix uses re.match(r"(\d+)\.(\d+)\.(\d+)", SA_VERSION) to extract only the three leading numeric version components, ignoring any suffix. This works because the regex captures digits up to the first non-digit in each segment, and stops after the third group, so 2.1.0b1 yields (2, 1, 0), 2.0.5.post1 yields (2, 0, 5), etc.

    It is worth noting that this can be achieved more simply (and correctly) using an additional dependency, packaging, by doing

    from packaging.version import parse as parse_version
    
    IS_VERSION_20 = parse_version(SA_VERSION) >= parse_version("2.0.0")

    With the key difference being that packaging correctly treats pre-releases as less than the release (2.0.0b1 < 2.0.0), while the regex treats them as equal.

@Dev-iL Dev-iL requested a review from a team as a code owner February 11, 2026 07:57
@github-actions
Copy link

github-actions bot commented Feb 11, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Dev-iL
Copy link
Author

Dev-iL commented Feb 11, 2026

I have read the CLA Document and I hereby sign the CLA

@Dev-iL Dev-iL force-pushed the 2602/sqla_prerelease branch 2 times, most recently from 9fcbb2a to 3f7e367 Compare February 11, 2026 08:38
Copy link
Collaborator

@sfc-gh-mraba sfc-gh-mraba left a comment

Choose a reason for hiding this comment

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

Thanks for for the contribution.
Pls take a look at the comments.

@Dev-iL Dev-iL force-pushed the 2602/sqla_prerelease branch 2 times, most recently from a4baee6 to 9481682 Compare February 12, 2026 08:45
@Dev-iL Dev-iL force-pushed the 2602/sqla_prerelease branch from 9481682 to 2339550 Compare February 12, 2026 09:43
@Dev-iL Dev-iL force-pushed the 2602/sqla_prerelease branch from 2339550 to 86b76bf Compare February 12, 2026 09:47
@Dev-iL
Copy link
Author

Dev-iL commented Feb 12, 2026

@sfc-gh-mraba Could you please restart CI?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SNOW-3066571: SQLAlchemy compat script doesn't handle versions containing letters

2 participants