Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Source code is also available at:
- Refactor column reflection internals into dedicated helpers to reduce complexity without changing behavior.
- Add `pytest-xdist` parallel test support via per-worker schema provisioning hooks.
- Bump `pandas` lower bound in `sa14` test environment from `<2.1` to `>=2.1.1,<2.2` to ensure pre-built wheels are available for Python 3.12
- Fix SQLAlchemy version parsing (SNOW-3066571)

# Release Notes

Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/sqlalchemy/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
string_types = (str,)
returns_unicode = util.symbol("RETURNS_UNICODE")

IS_VERSION_20 = tuple(int(v) for v in SA_VERSION.split(".")) >= (2, 0, 0)
IS_VERSION_20 = tuple(int(v) for v in SA_VERSION.split(".")[:2]) >= (2, 0)


def args_reducer(positions_to_drop: tuple):
Expand Down
33 changes: 33 additions & 0 deletions tests/test_compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved.
#
import importlib

import pytest

import snowflake.sqlalchemy.compat as compat_module


@pytest.fixture(scope="session", autouse=True)
def init_test_schema():
"""Neutralize the fixture that requires a live db connection."""
yield


@pytest.mark.parametrize(
("version", "expected"),
[
("2.0.0", True),
("3.1.0", True),
("1.3.0", False),
("2.0.5.post1", True),
("2.0.0rc2", True),
("2.0.0b1", True),
("0.5.0beta3", False),
("0.4.2a", False),
],
)
def test_is_version_20(version, expected, monkeypatch):
monkeypatch.setattr("sqlalchemy.__version__", version)
importlib.reload(compat_module)
assert compat_module.IS_VERSION_20 == expected