Skip to content

Commit cb7b143

Browse files
SNOW-UD: Fix tox_install_cmd.sh — integrate UD as first-priority branch
Replace the appended swap block with a proper 3-way conditional: ud_connector_path → snowflake_path → PyPI (in priority order). The appended approach ran the full PyPI install then the swap as a separate pass on every tox install_command invocation. The integrated approach mirrors the original design: UD takes explicit priority, snowflake_path is only used when UD is not set, and a single logical path runs per invocation. Also removes the decorative comment banners added by the previous edit, which were inconsistent with the surrounding code style. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 859f76e commit cb7b143

1 file changed

Lines changed: 15 additions & 24 deletions

File tree

scripts/tox_install_cmd.sh

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
set -e
44

5-
# ── Standard install ─────────────────────────────────────────────────
6-
# Install project dependencies using uv. This section is shared by
7-
# every tox environment and must remain provider-agnostic.
8-
# ─────────────────────────────────────────────────────────────────────
9-
105
# Check if uv is installed, and install it if not
116
if ! command -v uv &> /dev/null; then
127
echo "uv not found, installing it..."
@@ -24,32 +19,28 @@ done
2419

2520
echo "${uv_options[*]}"
2621

27-
# Default to empty, to ensure snowflake_path variable is defined.
22+
# Default to empty, to ensure variables are defined.
2823
snowflake_path=${snowflake_path:-""}
24+
ud_connector_path=${ud_connector_path:-""}
2925
python_version=$(python -c 'import sys; print(f"cp{sys.version_info.major}{sys.version_info.minor}")')
3026

31-
if [[ -z "${snowflake_path}" ]]; then
32-
echo "Using Python Connector from PyPI"
27+
if [[ -n "${ud_connector_path}" ]]; then
28+
echo "Installing Universal Driver connector"
29+
echo "UD connector path: ${ud_connector_path}"
30+
# Install all deps normally (old connector gets pulled in via snowflake-connector-python>=3.17.0)
3331
uv pip install ${uv_options[@]}
34-
else
32+
# Remove old connector and install UD in its place.
33+
# --reinstall ensures wheel files are always extracted even if the version
34+
# matches a previous install (uv otherwise skips re-extraction silently).
35+
uv pip uninstall snowflake-connector-python
36+
uv pip install --reinstall "${ud_connector_path}"
37+
elif [[ -n "${snowflake_path}" ]]; then
3538
echo "Installing locally built Python Connector"
3639
echo "Python Connector path: ${snowflake_path}"
3740
ls -al ${snowflake_path}
3841
uv pip install ${snowflake_path}/snowflake_connector_python*${python_version}*.whl
3942
uv pip install ${uv_options[@]}
40-
fi
41-
42-
# ── Universal Driver connector swap ──────────────────────────────────
43-
# When ud_connector_path is set, replace snowflake-connector-python
44-
# with the Universal Driver build. This is a no-op for normal CI.
45-
# ─────────────────────────────────────────────────────────────────────
46-
47-
ud_connector_path=${ud_connector_path:-""}
48-
if [[ -n "${ud_connector_path}" ]]; then
49-
echo "Swapping snowflake-connector-python → Universal Driver"
50-
echo " UD connector path: ${ud_connector_path}"
51-
# --reinstall ensures wheel files are always extracted even if the
52-
# version matches a previous install (uv otherwise skips silently).
53-
uv pip uninstall snowflake-connector-python
54-
uv pip install --reinstall "${ud_connector_path}"
43+
else
44+
echo "Using Python Connector from PyPI"
45+
uv pip install ${uv_options[@]}
5546
fi

0 commit comments

Comments
 (0)