Skip to content

Commit 40c2223

Browse files
Merge branch 'main' into SNOW-2112225-make-boto-libs-optional
2 parents 345669a + f442062 commit 40c2223

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1984
-141
lines changed

.github/workflows/build_test.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,7 @@ jobs:
133133
download_name: win_amd64
134134
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
135135
cloud-provider: [aws, azure, gcp]
136-
# TODO: When there are prebuilt wheels accessible for our dependencies (i.e. numpy)
137-
# for Python 3.13 windows runs can be re-enabled. Currently, according to numpy:
138-
# "Numpy built with MINGW-W64 on Windows 64 bits is experimental, and only available for
139-
# testing. You are advised not to use it for production."
140-
exclude:
141-
- os:
142-
image_name: windows-latest
143-
download_name: win_amd64
144-
python-version: "3.13"
136+
145137
steps:
146138
- uses: actions/checkout@v4
147139
- name: Set up Python
@@ -179,12 +171,17 @@ jobs:
179171
- name: Install tox
180172
run: python -m pip install tox>=4
181173
- name: Run tests
174+
# To run a single test on GHA use the below command:
175+
# run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-single-ci | sed 's/ /,/g'`
182176
run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-{extras,unit,integ,pandas,sso}-ci | sed 's/ /,/g'`
177+
183178
env:
184179
PYTHON_VERSION: ${{ matrix.python-version }}
185180
cloud_provider: ${{ matrix.cloud-provider }}
186181
PYTEST_ADDOPTS: --color=yes --tb=short
187182
TOX_PARALLEL_NO_SPINNER: 1
183+
# To specify the test name (in single test mode) pass this env variable:
184+
# SINGLE_TEST_NAME: test/path/filename.py::test_name
188185
shell: bash
189186
- name: Combine coverages
190187
run: python -m tox run -e coverage --skip-missing-interpreters false

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,7 @@ core.*
125125
# Compiled Cython
126126
src/snowflake/connector/arrow_iterator.cpp
127127
src/snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_arrow_iterator.cpp
128+
129+
# Prober files
130+
prober/parameters.json
131+
prober/snowflake_prober.egg-info/

DESCRIPTION.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,20 @@ https://docs.snowflake.com/
77
Source code is also available at: https://github.com/snowflakedb/snowflake-connector-python
88

99
# Release Notes
10-
- v3.16.0(TBD)
10+
- v3.16(TBD)
11+
- Bumped numpy dependency from <2.1.0 to <=2.2.4
12+
- Added Windows support for Python 3.13.
13+
- Add `bulk_upload_chunks` parameter to `write_pandas` function. Setting this parameter to True changes the behaviour of write_pandas function to first write all the data chunks to the local disk and then perform the wildcard upload of the chunks folder to the stage. In default behaviour the chunks are being saved, uploaded and deleted one by one.
14+
- Added support for new authentication mechanism PAT with external session ID.
15+
- Added `client_fetch_use_mp` parameter that enables multiprocessed fetching of result batches.
16+
- Make botocore and boto3 an optional dependencies pack.
17+
18+
- v3.15.1(May 20, 2025)
1119
- Added basic arrow support for Interval types.
1220
- Fix `write_pandas` special characters usage in the location name.
1321
- Fix usage of `use_virtual_url` when building the location for gcs storage client.
1422
- Bind cryptography to <=44.0.3 to avoid issues with 45.0.0.
15-
- Make botocore and boto3 an optional dependencies pack
23+
- Added support for Snowflake OAuth for local applications.
1624

1725
- v3.15.0(Apr 29,2025)
1826
- Bumped up min boto and botocore version to 1.24.

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ prune tested_requirements
2828
prune src/snowflake/connector/nanoarrow_cpp/scripts
2929
prune __pycache__
3030
prune samples
31+
prune prober

ci/docker/connector_test/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ FROM $BASE_IMAGE
33

44
RUN yum install -y java-11-openjdk
55

6-
# TODO: When there are prebuilt wheels accessible for our dependencies (i.e. numpy)
7-
# for Python 3.13 this rust cargo install command can be removed.
6+
# Our dependencies rely on the Rust toolchain being available in the build-time environment (https://github.com/pyca/cryptography/issues/5771)
87
RUN yum -y install rust cargo
98

109
# This is to solve permission issue, read https://denibertovic.com/posts/handling-permissions-with-docker-volumes/

ci/docker/connector_test_lambda/Dockerfile313

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,13 @@ FROM public.ecr.aws/lambda/python:3.13-x86_64
22

33
WORKDIR /home/user/snowflake-connector-python
44

5-
# TODO: When there are prebuilt wheels accessible for our dependencies (i.e. numpy)
6-
# for Python 3.13 all dnf ... commands installing building kits can be removed.
7-
8-
# Install necessary packages and compilers - we need to build numpy for newer version
9-
# Update dnf and install development tools
105
RUN dnf -y update && \
11-
dnf -y install \
12-
gcc \
13-
gcc-c++ \
14-
make \
15-
python3-devel \
16-
openblas-devel \
17-
lapack-devel && \
186
dnf clean all
7+
8+
# Our dependencies rely on the Rust toolchain being available in the build-time environment (https://github.com/pyca/cryptography/issues/5771)
199
RUN dnf -y install rust cargo
2010
RUN dnf -y upgrade
2111

22-
2312
RUN chmod 777 /home/user/snowflake-connector-python
2413
ENV PATH="${PATH}:/opt/python/cp313-cp313/bin/"
2514
ENV PYTHONPATH="${PYTHONPATH}:/home/user/snowflake-connector-python/ci/docker/connector_test_lambda/"

prober/Dockerfile

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
FROM alpine:3.18
2+
3+
# boilerplate labels required by validation when pushing to ACR, ECR & GCR
4+
LABEL org.opencontainers.image.source="https://github.com/snowflakedb/snowflake-connector-python"
5+
LABEL com.snowflake.owners.email="[email protected]"
6+
LABEL com.snowflake.owners.slack="triage-snow-drivers-warsaw-dl"
7+
LABEL com.snowflake.owners.team="Snow Drivers"
8+
LABEL com.snowflake.owners.jira_area="Developer Platform"
9+
LABEL com.snowflake.owners.jira_component="Python Driver"
10+
# fake layers label to pass the validation
11+
LABEL com.snowflake.ugcbi.layers="sha256:850959b749c07b254308a4d1a84686fd7c09fcb94aeae33cc5748aa07e5cb232,sha256:b79d3c4628a989cbb8bc6f0bf0940ff33a68da2dca9c1ffbf8cfb2a27ac8d133,sha256:1cbcc0411a84fbce85e7ee2956c8c1e67b8e0edc81746a33d9da48c852037c3e,sha256:07e89b796f91d37255c6eec926b066d6818f3f2edc344a584d1b9566f77e1c27,sha256:84ff92691f909a05b224e1c56abb4864f01b4f8e3c854e4bb4c7baf1d3f6d652,sha256:3ab72684daee4eea64c3ae78a43ea332b86358446b6f2904dca4b634712e1537"
12+
13+
RUN apk add --no-cache \
14+
bash \
15+
git \
16+
make \
17+
g++ \
18+
zlib-dev \
19+
openssl-dev \
20+
libffi-dev \
21+
jq
22+
23+
ENV HOME="/home/driveruser"
24+
25+
# Create a group with GID=1000 and a user with UID=1000
26+
RUN addgroup -g 1000 drivergroup && \
27+
adduser -u 1000 -G drivergroup -D driveruser
28+
29+
# Set permissions for the non-root user
30+
RUN mkdir -p ${HOME} && \
31+
chown -R driveruser:drivergroup ${HOME}
32+
33+
# Switch to the non-root user
34+
USER driveruser
35+
WORKDIR ${HOME}
36+
37+
# Set environment variables
38+
ENV PYENV_ROOT="${HOME}/.pyenv"
39+
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"
40+
41+
42+
# Install pyenv
43+
RUN git clone --depth=1 https://github.com/pyenv/pyenv.git ${PYENV_ROOT}
44+
45+
# Build arguments for Python versions and Snowflake connector versions
46+
ARG MATRIX_VERSION='{"3.13.4": ["3.15.0", "3.13.2", "3.14.0", "3.12.3", "3.12.1", "3.12.4", "3.11.0", "3.12.2", "3.6.0", "3.7.0"], "3.9.22": ["3.15.0", "3.13.2", "3.14.0", "3.12.3", "3.12.1", "3.12.4", "3.11.0", "3.12.2", "3.6.0", "3.7.0"]}'
47+
48+
49+
# Install Python versions from ARG MATRIX_VERSION
50+
RUN eval "$(pyenv init --path)" && \
51+
for python_version in $(echo $MATRIX_VERSION | jq -r 'keys[]'); do \
52+
pyenv install $python_version || echo "Failed to install Python $python_version"; \
53+
done
54+
55+
# Create virtual environments for each combination of Python and Snowflake connector versions
56+
RUN for python_version in $(echo $MATRIX_VERSION | jq -r 'keys[]'); do \
57+
for connector_version in $(echo $MATRIX_VERSION | jq -r ".\"${python_version}\"[]"); do \
58+
venv_path="${HOME}/venvs/python_${python_version}_connector_${connector_version}"; \
59+
$PYENV_ROOT/versions/$python_version/bin/python -m venv $venv_path && \
60+
$venv_path/bin/pip install --upgrade pip && \
61+
$venv_path/bin/pip install snowflake-connector-python==$connector_version; \
62+
done; \
63+
done
64+
65+
# Copy the prober script into the container
66+
RUN mkdir -p prober/probes/
67+
COPY __init__.py prober
68+
COPY setup.py prober
69+
COPY entrypoint.sh prober
70+
COPY probes/* prober/probes
71+
72+
# Install /prober in editable mode for each virtual environment
73+
RUN for venv in ${HOME}/venvs/*; do \
74+
source $venv/bin/activate && \
75+
pip install -e ${HOME}/prober && \
76+
deactivate; \
77+
done

prober/Jenkinsfile.groovy

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
pipeline {
2+
agent { label 'regular-memory-node' }
3+
4+
options {
5+
ansiColor('xterm')
6+
timestamps()
7+
}
8+
9+
environment {
10+
VAULT_CREDENTIALS = credentials('vault-jenkins')
11+
COMMIT_SHA_SHORT = sh(script: 'cd PythonConnector/prober && git rev-parse --short HEAD', returnStdout: true).trim()
12+
IMAGE_NAME = 'snowdrivers/python-driver-prober'
13+
TEAM_NAME = 'Snow Drivers'
14+
TEAM_JIRA_DL = 'triage-snow-drivers-warsaw-dl'
15+
TEAM_JIRA_AREA = 'Developer Platform'
16+
TEAM_JIRA_COMPONENT = 'Python Driver'
17+
}
18+
19+
stages {
20+
stage('Build Image') {
21+
steps {
22+
dir('./PythonConnector/prober') {
23+
sh """
24+
ls -l
25+
docker build \
26+
-t ${IMAGE_NAME}:${COMMIT_SHA_SHORT} \
27+
--label "org.opencontainers.image.revision=${COMMIT_SHA_SHORT}" \
28+
-f ./Dockerfile .
29+
"""
30+
}
31+
}
32+
}
33+
34+
stage('Checkout Jenkins Push Scripts') {
35+
steps {
36+
dir('k8sc-jenkins_scripts') {
37+
git branch: 'master',
38+
credentialsId: 'jenkins-snowflake-github-app-3',
39+
url: 'https://github.com/snowflakedb/k8sc-jenkins_scripts.git'
40+
}
41+
}
42+
}
43+
44+
stage('Push Image') {
45+
steps {
46+
sh """
47+
./k8sc-jenkins_scripts/jenkins_push.sh \
48+
-r "${VAULT_CREDENTIALS_USR}" \
49+
-s "${VAULT_CREDENTIALS_PSW}" \
50+
-i "${IMAGE_NAME}" \
51+
-v "${COMMIT_SHA_SHORT}" \
52+
-n "${TEAM_JIRA_DL}" \
53+
-a "${TEAM_JIRA_AREA}" \
54+
-C "${TEAM_JIRA_COMPONENT}"
55+
"""
56+
}
57+
}
58+
}
59+
60+
post {
61+
always {
62+
cleanWs()
63+
}
64+
}
65+
}

prober/entrypoint.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
# Initialize an empty string to hold all parameters
4+
python_version=""
5+
connector_version=""
6+
params=""
7+
8+
# Parse command-line arguments
9+
while [[ "$#" -gt 0 ]]; do
10+
if [[ "$1" == "--python_version" ]]; then
11+
python_version="$2"
12+
shift 2
13+
elif [[ "$1" == "--connector_version" ]]; then
14+
connector_version="$2"
15+
shift 2
16+
else
17+
params+="$1 $2 "
18+
shift 2
19+
fi
20+
done
21+
22+
# Construct the virtual environment path
23+
venv_path="${HOME}/venvs/python_${python_version}_connector_${connector_version}"
24+
25+
# Check if the virtual environment exists
26+
if [[ ! -d "$venv_path" ]]; then
27+
echo "Error: Virtual environment not found at $venv_path"
28+
exit 1
29+
fi
30+
31+
# Run main.py with given venv
32+
echo "Running main.py with virtual environment: $venv_path"
33+
source "$venv_path/bin/activate"
34+
prober $params
35+
status=$?
36+
deactivate
37+
38+
# Check the exit status of prober
39+
if [[ $status -ne 0 ]]; then
40+
echo "Error: prober returned failure."
41+
exit 1
42+
else
43+
echo "Success: prober returned success."
44+
exit 0
45+
fi

0 commit comments

Comments
 (0)