From 95e86c41ba32ece6bedefb7610277e65c3c8ef70 Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Tue, 12 Mar 2024 12:52:58 +0100 Subject: [PATCH 01/19] SNOW-1065172-gh-workflow-optimization: update gh actions versions to latest --- .github/workflows/build_test.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 5284a088..3c6b9d30 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -24,9 +24,9 @@ jobs: name: Check linting runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.8' - name: Display Python version @@ -37,7 +37,7 @@ jobs: run: python -m pip install tox - name: Set PY run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - - uses: actions/cache@v1 + - uses: actions/cache@v4 with: path: ~/.cache/pre-commit key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} @@ -61,9 +61,9 @@ jobs: python-version: ["3.8"] cloud-provider: [aws, azure, gcp] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Display Python version @@ -89,7 +89,7 @@ jobs: - name: Combine coverages run: python -m tox -e coverage --skip-missing-interpreters false shell: bash - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: coverage_${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} path: | @@ -102,12 +102,12 @@ jobs: needs: [test] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/download-artifact@v2 + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 with: path: artifacts - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.8' - name: Display Python version @@ -131,15 +131,15 @@ jobs: - name: Combine coverages run: python -m tox -e coverage - name: Publish html coverage - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: overall_cov_html path: .tox/htmlcov - name: Publish xml coverage - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: overall_cov_xml path: .tox/coverage.xml - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab with: file: .tox/coverage.xml From c1c208f01ffd7a72dcabcc17ee93c57ab1b48a3c Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Tue, 12 Mar 2024 13:00:13 +0100 Subject: [PATCH 02/19] SNOW-1065172-gh-workflow-optimization: run linting without tox --- .github/workflows/build_test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 3c6b9d30..1d9433ad 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -31,10 +31,10 @@ jobs: python-version: '3.8' - name: Display Python version run: python -c "import sys; import os; print(\"\n\".join(os.environ[\"PATH\"].split(os.pathsep))); print(sys.version); print(sys.executable);" - - name: Upgrade setuptools, pip and wheel - run: python -m pip install -U setuptools pip wheel - - name: Install tox - run: python -m pip install tox + - name: Upgrade pip + run: python -m pip install -U pip + - name: Install pre-commit + run: python -m pip install -U pre-commit - name: Set PY run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@v4 @@ -42,7 +42,7 @@ jobs: path: ~/.cache/pre-commit key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} - name: Run fix_lint - run: python -m tox -e fix_lint + run: pre-commit run --all-files test: name: Test ${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} From 2eca636009b6a1c69b9d1c6dcfb263d8159d2841 Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Wed, 13 Mar 2024 10:46:32 +0100 Subject: [PATCH 03/19] SNOW-1065172-gh-workflow-optimization: move project definition to pyproject.toml --- .github/workflows/build_test.yml | 182 +++++++++++++--------------- pyproject.toml | 91 ++++++++++++++ setup.cfg | 77 ------------ setup.py | 17 --- src/snowflake/sqlalchemy/version.py | 2 +- 5 files changed, 179 insertions(+), 190 deletions(-) delete mode 100644 setup.py diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 1d9433ad..8b7e75fc 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -31,115 +31,107 @@ jobs: python-version: '3.8' - name: Display Python version run: python -c "import sys; import os; print(\"\n\".join(os.environ[\"PATH\"].split(os.pathsep))); print(sys.version); print(sys.executable);" - - name: Upgrade pip - run: python -m pip install -U pip - - name: Install pre-commit - run: python -m pip install -U pre-commit + - name: Upgrade and install tools + run: | + python -m pip install -U pip + python -m pip install -U hatch + - name: Setup env + run: hatch env create default - name: Set PY run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@v4 with: path: ~/.cache/pre-commit key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} - - name: Run fix_lint - run: pre-commit run --all-files - - test: - name: Test ${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - needs: lint - runs-on: ${{ matrix.os.image_name }} - strategy: - fail-fast: false - matrix: - os: - - image_name: ubuntu-latest - download_name: manylinux_x86_64 - - image_name: macos-latest - download_name: macosx_x86_64 - - image_name: windows-2019 - download_name: win_amd64 - python-version: ["3.8"] - cloud-provider: [aws, azure, gcp] - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Display Python version - run: python -c "import sys; print(sys.version)" - - name: Setup parameters file - shell: bash - env: - PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} - run: | - gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ - .github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py - - name: Upgrade setuptools, pip and wheel - run: python -m pip install -U setuptools pip wheel - - name: Install tox - run: python -m pip install tox - - name: List installed packages - run: python -m pip freeze - - name: Run tests - run: python -m tox -e "py${PYTHON_VERSION/\./}" --skip-missing-interpreters false - env: - PYTHON_VERSION: ${{ matrix.python-version }} - PYTEST_ADDOPTS: -vvv --color=yes --tb=short - - name: Combine coverages - run: python -m tox -e coverage --skip-missing-interpreters false - shell: bash - - uses: actions/upload-artifact@v4 - with: - name: coverage_${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - path: | - .tox/.coverage - .tox/coverage.xml + - name: Run lint checks + run: hatch run check - combine-coverage: - if: ${{ success() || failure() }} - name: Combine coverage - needs: [test] - runs-on: ubuntu-latest + test-dialect: + name: Test dialect ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} + needs: lint + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ + ubuntu-latests, + macos-latest, + windows-latest, + ] + python-version: ["3.8"] + cloud-provider: [ + aws, + azure, + gcp, + ] steps: - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4 - with: - path: artifacts - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: ${{ matrix.python-version }} - name: Display Python version - run: python -c "import sys; print(sys.version)" - - name: Upgrade setuptools and pip - run: python -m pip install -U setuptools pip wheel - - name: Install tox - run: python -m pip install tox - - name: Collect all coverages to one dir + run: python -VV + - name: Setup parameters file + shell: bash + env: + PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} + run: | + gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ + .github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py + - name: Upgrade pip and install hatch run: | - python -c ' - from pathlib import Path - import shutil - src_dir = Path("artifacts") - dst_dir = Path(".") / ".tox" - dst_dir.mkdir() - for src_file in src_dir.glob("*/.coverage"): - dst_file = dst_dir / f".coverage.{src_file.parent.name[9:]}" - print(f"{src_file} copy to {dst_file}") - shutil.copy(str(src_file), str(dst_file))' - - name: Combine coverages - run: python -m tox -e coverage - - name: Publish html coverage - uses: actions/upload-artifact@v4 + python -m pip install -U pip + python -m pip install -U hatch + - name: Run tests + run: hatch run test-dialect + - uses: actions/upload-artifact@v4 with: - name: overall_cov_html - path: .tox/htmlcov - - name: Publish xml coverage - uses: actions/upload-artifact@v4 + name: coverage.xml + path: | + ./coverage.xml + + test-dialect-compatibility: + name: Test dialect compatibility ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} + needs: test-dialect + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ + ubuntu-latests, + macos-latest, + windows-latest, + ] + python-version: ["3.8"] + cloud-provider: [ + aws, + azure, + gcp, + ] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 with: - name: overall_cov_xml - path: .tox/coverage.xml - - uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab + python-version: ${{ matrix.python-version }} + - name: Display Python version + run: python -VV + - name: Setup parameters file + shell: bash + env: + PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} + run: | + gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ + .github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py + - name: Upgrade pip and install hatch + run: | + python -m pip install -U pip + python -m pip install -U hatch + - name: Run tests + run: hatch run test-dialect-compatibility + - uses: actions/upload-artifact@v4 with: - file: .tox/coverage.xml + name: coverage.xml + path: | + ./coverage.xml diff --git a/pyproject.toml b/pyproject.toml index 907176c3..77372075 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,94 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "snowflake-sqlalchemy" +dynamic = ["version"] +description = "Snowflake SQLAlchemy Dialect" +readme = "README.md" +license = "Apache-2.0" +requires-python = ">=3.8" +authors = [ + { name = "Snowflake Inc.", email = "triage-snowpark-python-api-dl@snowflake.com" }, +] +keywords = ["Snowflake", "analytics", "cloud", "database", "db", "warehouse"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Environment :: Other Environment", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Intended Audience :: Information Technology", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: SQL", + "Topic :: Database", + "Topic :: Scientific/Engineering :: Information Analysis", + "Topic :: Software Development", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Libraries :: Application Frameworks", + "Topic :: Software Development :: Libraries :: Python Modules", +] +dependencies = ["SQLAlchemy", "snowflake-connector-python<4.0.0"] + +[tool.hatch.version] +path = "src/snowflake/sqlalchemy/version.py" + +[project.optional-dependencies] +development = [ + "pre-commit", + "pytest", + "pytest-cov", + "pytest-timeout", + "pytest-rerunfailures", + "pytz", + "numpy", +] +pandas = ["snowflake-connector-python[pandas]<4.0.0"] + +[project.entry-points."sqlalchemy.dialects"] +snowflake = "snowflake.sqlalchemy:dialect" + +[project.urls] +Changelog = "https://github.com/snowflakedb/snowflake-sqlalchemy/blob/main/DESCRIPTION.md" +Documentation = "https://docs.snowflake.com/en/user-guide/sqlalchemy.html" +Homepage = "https://www.snowflake.com/" +Issues = "https://github.com/snowflakedb/snowflake-sqlalchemy/issues" +Source = "https://github.com/snowflakedb/snowflake-sqlalchemy" + +[tool.hatch.build.targets.sdist] +exclude = ["/.github"] + +[tool.hatch.build.targets.wheel] +packages = ["src/snowflake"] + +[tool.hatch.envs.default] +extra-dependencies = ["SQLAlchemy<2.0.0,>=1.4.19"] +features = ["development", "pandas"] +python = "3.8" + +[tool.hatch.envs.sa20] +extra-dependencies = ["SQLAlchemy>=2.0.0"] +python = "3.8" + +[tool.hatch.envs.default.env-vars] +COVERAGE_FILE = ".coverage.xml" +SQLACHEMY_WARN_20 = "1" + +[tool.hatch.envs.default.scripts] +check = "pre-commit run --all-files" +test-dialect = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite --co" +test-dialect-compatibility = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml tests/sqlalchemy_test_suite --co" + [tool.ruff] line-length = 88 diff --git a/setup.cfg b/setup.cfg index 04011f04..7924cc57 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,80 +1,3 @@ -[bdist_wheel] -universal = 1 - -[metadata] -name = snowflake-sqlalchemy -description = Snowflake SQLAlchemy Dialect -long_description = file: DESCRIPTION.md -long_description_content_type = text/markdown -url = https://www.snowflake.com/ -author = Snowflake, Inc -author_email = triage-snowpark-python-api-dl@snowflake.com -license = Apache-2.0 -license_files = LICENSE.txt -classifiers = - Development Status :: 5 - Production/Stable - Environment :: Console - Environment :: Other Environment - Intended Audience :: Developers - Intended Audience :: Education - Intended Audience :: Information Technology - Intended Audience :: System Administrators - License :: OSI Approved :: Apache Software License - Operating System :: OS Independent - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: SQL - Topic :: Database - Topic :: Scientific/Engineering :: Information Analysis - Topic :: Software Development - Topic :: Software Development :: Libraries - Topic :: Software Development :: Libraries :: Application Frameworks - Topic :: Software Development :: Libraries :: Python Modules -keywords = Snowflake db database cloud analytics warehouse -project_urls = - Documentation=https://docs.snowflake.com/en/user-guide/sqlalchemy.html - Source=https://github.com/snowflakedb/snowflake-sqlalchemy - Issues=https://github.com/snowflakedb/snowflake-sqlalchemy/issues - Changelog=https://github.com/snowflakedb/snowflake-sqlalchemy/blob/main/DESCRIPTION.md - -[options] -python_requires = >=3.7 -packages = find_namespace: -install_requires = - importlib-metadata;python_version<"3.8" - sqlalchemy<2.0.0,>=1.4.0 -; Keep in sync with extras dependency - snowflake-connector-python<4.0.0 -include_package_data = True -package_dir = - =src -zip_safe = False - -[options.packages.find] -where = src -include = snowflake.* - -[options.entry_points] -sqlalchemy.dialects = - snowflake=snowflake.sqlalchemy:dialect - -[options.extras_require] -development = - pytest - pytest-cov - pytest-rerunfailures - pytest-timeout - mock - pytz - numpy -pandas = - snowflake-connector-python[pandas]<4.0.0 - [sqla_testing] requirement_cls=snowflake.sqlalchemy.requirements:Requirements profile_file=tests/profiles.txt diff --git a/setup.py b/setup.py deleted file mode 100644 index 0ec32717..00000000 --- a/setup.py +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved. -# - -import os - -from setuptools import setup - -SQLALCHEMY_SRC_DIR = os.path.join("src", "snowflake", "sqlalchemy") -VERSION = (1, 1, 1, None) # Default -with open(os.path.join(SQLALCHEMY_SRC_DIR, "version.py"), encoding="utf-8") as f: - exec(f.read()) - version = ".".join([str(v) for v in VERSION if v is not None]) - -setup( - version=version, -) diff --git a/src/snowflake/sqlalchemy/version.py b/src/snowflake/sqlalchemy/version.py index d4318b86..24f188c2 100644 --- a/src/snowflake/sqlalchemy/version.py +++ b/src/snowflake/sqlalchemy/version.py @@ -3,4 +3,4 @@ # # Update this for the versions # Don't change the forth version number from None -VERSION = (1, 5, 2, None) +VERSION = "1.5.2" From 1b93062c6bf6d6e7a75d764931e63365bcee10ad Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Wed, 13 Mar 2024 11:34:22 +0100 Subject: [PATCH 04/19] SNOW-1065172-gh-workflow-optimization: fix typo in os matrix --- .github/workflows/build_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 8b7e75fc..e0ce81e7 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -99,7 +99,7 @@ jobs: fail-fast: false matrix: os: [ - ubuntu-latests, + ubuntu-latest, macos-latest, windows-latest, ] From dc8e517fe5bcc652ec533c34c12c3c74d08a3f1f Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Wed, 13 Mar 2024 11:37:01 +0100 Subject: [PATCH 05/19] SNOW-1065172-gh-workflow-optimization: fix typo in os matrix --- .github/workflows/build_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index e0ce81e7..6bfe0bfb 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -54,7 +54,7 @@ jobs: fail-fast: false matrix: os: [ - ubuntu-latests, + ubuntu-latest, macos-latest, windows-latest, ] From 232fd1168652821e0efb6a24058f43cf67f2cbe0 Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Wed, 13 Mar 2024 11:49:22 +0100 Subject: [PATCH 06/19] SNOW-1065172-gh-workflow-optimization: remove displaying python version --- .github/workflows/build_test.yml | 11 +++++------ pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 6bfe0bfb..b5ec95df 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -70,8 +70,11 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Display Python version - run: python -VV + - name: Upgrade pip and prepare environment + run: | + python -m pip install -U pip + python -m pip install -U hatch + python -m hatch env create default - name: Setup parameters file shell: bash env: @@ -79,10 +82,6 @@ jobs: run: | gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ .github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py - - name: Upgrade pip and install hatch - run: | - python -m pip install -U pip - python -m pip install -U hatch - name: Run tests run: hatch run test-dialect - uses: actions/upload-artifact@v4 diff --git a/pyproject.toml b/pyproject.toml index 77372075..f56844ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,7 +81,7 @@ extra-dependencies = ["SQLAlchemy>=2.0.0"] python = "3.8" [tool.hatch.envs.default.env-vars] -COVERAGE_FILE = ".coverage.xml" +COVERAGE_FILE = "coverage.xml" SQLACHEMY_WARN_20 = "1" [tool.hatch.envs.default.scripts] From 8af09f371124b8d466d6ff5d4c5a14a297c08598 Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Wed, 13 Mar 2024 11:56:41 +0100 Subject: [PATCH 07/19] SNOW-1065172-gh-workflow-optimization: unique names for coverage reports per job --- .github/workflows/build_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index b5ec95df..bc44fde0 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -86,7 +86,7 @@ jobs: run: hatch run test-dialect - uses: actions/upload-artifact@v4 with: - name: coverage.xml + name: coverage.xml_dialect-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} path: | ./coverage.xml @@ -131,6 +131,6 @@ jobs: run: hatch run test-dialect-compatibility - uses: actions/upload-artifact@v4 with: - name: coverage.xml + name: coverage.xml_dialect-compatibility-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} path: | ./coverage.xml From b123105a4ec3ccd2b7632d227cc24b1f25bc4379 Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Wed, 13 Mar 2024 12:19:08 +0100 Subject: [PATCH 08/19] SNOW-1065172-gh-workflow-optimization: update checkout rules --- .github/workflows/build_test.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index bc44fde0..6a5663da 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -25,18 +25,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.8' - - name: Display Python version - run: python -c "import sys; import os; print(\"\n\".join(os.environ[\"PATH\"].split(os.pathsep))); print(sys.version); print(sys.executable);" - name: Upgrade and install tools run: | python -m pip install -U pip python -m pip install -U hatch - - name: Setup env - run: hatch env create default + python -m hatch env create default - name: Set PY run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@v4 @@ -66,6 +65,8 @@ jobs: ] steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - name: Set up Python uses: actions/setup-python@v5 with: @@ -110,6 +111,8 @@ jobs: ] steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - name: Set up Python uses: actions/setup-python@v5 with: From db1fc2e4fb4f597b434bb3463b33365008cb78ee Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Wed, 13 Mar 2024 12:32:42 +0100 Subject: [PATCH 09/19] SNOW-1065172-gh-workflow-optimization: full tests jobs --- .github/workflows/build_test.yml | 57 +++++++++++++++++++++++++++++--- pyproject.toml | 5 +-- 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 6a5663da..978792de 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -93,7 +93,55 @@ jobs: test-dialect-compatibility: name: Test dialect compatibility ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - needs: test-dialect + # needs: test-dialect + needs: lint + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ + ubuntu-latest, + macos-latest, + windows-latest, + ] + python-version: ["3.8"] + cloud-provider: [ + aws, + azure, + gcp, + ] + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Upgrade pip and install hatch + run: | + python -m pip install -U pip + python -m pip install -U hatch + python -m hatch env create default + - name: Setup parameters file + shell: bash + env: + PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} + run: | + gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ + .github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py + - name: Run tests + run: hatch run test-dialect-compatibility + - uses: actions/upload-artifact@v4 + with: + name: coverage.xml_dialect-compatibility-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} + path: | + ./coverage.xml + + test-dialect-run-v20: + name: Test dialect run v20 ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} + # needs: test-dialect + needs: lint runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -117,8 +165,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Display Python version - run: python -VV - name: Setup parameters file shell: bash env: @@ -130,10 +176,11 @@ jobs: run: | python -m pip install -U pip python -m pip install -U hatch + python -m hatch env create default - name: Run tests - run: hatch run test-dialect-compatibility + run: hatch run test-run_v20 - uses: actions/upload-artifact@v4 with: - name: coverage.xml_dialect-compatibility-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} + name: coverage.xml_dialect-run-20-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} path: | ./coverage.xml diff --git a/pyproject.toml b/pyproject.toml index f56844ca..8b6ccb8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,8 +86,9 @@ SQLACHEMY_WARN_20 = "1" [tool.hatch.envs.default.scripts] check = "pre-commit run --all-files" -test-dialect = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite --co" -test-dialect-compatibility = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml tests/sqlalchemy_test_suite --co" +test-dialect = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite" +test-dialect-compatibility = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml tests/sqlalchemy_test_suite" +test-run_v20 = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite --run_v20_sqlalchemy" [tool.ruff] line-length = 88 From 4616f5c16c41c64c663ad8cc0f563e561990412a Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Wed, 13 Mar 2024 12:58:46 +0100 Subject: [PATCH 10/19] SNOW-1065172-gh-workflow-optimization: markers added --- pyproject.toml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 8b6ccb8b..eec99926 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -95,3 +95,23 @@ line-length = 88 [tool.black] line-length = 88 + +[tool.pytest.ini_options] +markers = [ + # Optional dependency groups markers + "lambda: AWS lambda tests", + "pandas: tests for pandas integration", + "sso: tests for sso optional dependency integration", + # Cloud provider markers + "aws: tests for Amazon Cloud storage", + "azure: tests for Azure Cloud storage", + "gcp: tests for Google Cloud storage", + # Test type markers + "integ: integration tests", + "unit: unit tests", + "skipolddriver: skip for old driver tests", + # Other markers + "timeout: tests that need a timeout time", + "internal: tests that could but should only run on our internal CI", + "external: tests that could but should only run on our external CI", +] From 9e3549d09a88ca7b7cdff949b0abe48c04162e44 Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Wed, 13 Mar 2024 15:59:15 +0100 Subject: [PATCH 11/19] SNOW-1065172-gh-workflow-optimization: gh-cache-sum script --- .github/workflows/build_test.yml | 3 ++- pyproject.toml | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 978792de..1a8eb727 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -36,8 +36,9 @@ jobs: python -m pip install -U pip python -m pip install -U hatch python -m hatch env create default + python -m hatch env find - name: Set PY - run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV + run: echo "PY=$(hatch run gh-cache-sum)" >> $GITHUB_ENV - uses: actions/cache@v4 with: path: ~/.cache/pre-commit diff --git a/pyproject.toml b/pyproject.toml index eec99926..5f135d59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules", ] -dependencies = ["SQLAlchemy", "snowflake-connector-python<4.0.0"] +dependencies = ["SQLAlchemy", "snowflake-connector-python"] [tool.hatch.version] path = "src/snowflake/sqlalchemy/version.py" @@ -53,7 +53,7 @@ development = [ "pytz", "numpy", ] -pandas = ["snowflake-connector-python[pandas]<4.0.0"] +pandas = ["snowflake-connector-python[pandas]"] [project.entry-points."sqlalchemy.dialects"] snowflake = "snowflake.sqlalchemy:dialect" @@ -89,6 +89,7 @@ check = "pre-commit run --all-files" test-dialect = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite" test-dialect-compatibility = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml tests/sqlalchemy_test_suite" test-run_v20 = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite --run_v20_sqlalchemy" +gh-cache-sum = "python -VV | sha256sum | cut -d' ' -f1" [tool.ruff] line-length = 88 From 2f7007e75e59351a29de874004d604cb6d556dc3 Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Wed, 13 Mar 2024 17:53:50 +0100 Subject: [PATCH 12/19] SNOW-1065172-gh-workflow-optimization: dependencies order --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5f135d59..8707fae3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules", ] -dependencies = ["SQLAlchemy", "snowflake-connector-python"] +dependencies = ["snowflake-connector-python", "SQLAlchemy"] [tool.hatch.version] path = "src/snowflake/sqlalchemy/version.py" @@ -52,6 +52,7 @@ development = [ "pytest-rerunfailures", "pytz", "numpy", + "mock", ] pandas = ["snowflake-connector-python[pandas]"] From c249291825bb5997245ecc98eb8f5db8fd355e56 Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Wed, 13 Mar 2024 18:22:19 +0100 Subject: [PATCH 13/19] SNOW-1065172-gh-workflow-optimization: fix VERSIONS parsing after migration to hatch --- src/snowflake/sqlalchemy/_constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/snowflake/sqlalchemy/_constants.py b/src/snowflake/sqlalchemy/_constants.py index dad5b19b..46af4454 100644 --- a/src/snowflake/sqlalchemy/_constants.py +++ b/src/snowflake/sqlalchemy/_constants.py @@ -9,4 +9,4 @@ PARAM_INTERNAL_APPLICATION_VERSION = "internal_application_version" APPLICATION_NAME = "SnowflakeSQLAlchemy" -SNOWFLAKE_SQLALCHEMY_VERSION = ".".join([str(v) for v in VERSION if v is not None]) +SNOWFLAKE_SQLALCHEMY_VERSION = VERSION From 17c3762c363b596e73249ec493ece505238e6aeb Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Thu, 14 Mar 2024 09:20:41 +0100 Subject: [PATCH 14/19] SNOW-1065172-gh-workflow-optimization: test_pandas_rewrite mark timeout and flaky Sometimes on GCP this test stalls. Until we figure out what is the real prblem we will retry and add timeout. --- tests/test_pandas.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_pandas.py b/tests/test_pandas.py index aadfb9cf..3d1365a9 100644 --- a/tests/test_pandas.py +++ b/tests/test_pandas.py @@ -297,6 +297,8 @@ def test_timezone(db_parameters): conn.exec_driver_sql(f"DROP TABLE {test_table_name};") +@pytest.mark.flaky(reruns=3, reruns_delay=7) +@pytest.mark.timeout(45) def test_pandas_writeback(engine_testaccount, run_v20_sqlalchemy): if run_v20_sqlalchemy and sys.version_info < (3, 8): pytest.skip( From 07b7fb972bc297b5a890955d587cd4baa37b40c0 Mon Sep 17 00:00:00 2001 From: Adam Stus Date: Thu, 14 Mar 2024 14:42:44 +0100 Subject: [PATCH 15/19] Added engine with numpy fixture --- tests/conftest.py | 10 ++++++- tests/test_pandas.py | 69 +++++++++++--------------------------------- 2 files changed, 26 insertions(+), 53 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index e22e4d42..33e38822 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -153,7 +153,7 @@ def get_db_parameters(): return ret -def get_engine(user=None, password=None, account=None, schema=None): +def get_engine(user=None, password=None, account=None, schema=None, numpy=False): """ Creates a connection using the parameters defined in JDBC connect string """ @@ -178,6 +178,7 @@ def get_engine(user=None, password=None, account=None, schema=None): schema=TEST_SCHEMA if not schema else schema, account=ret["account"], protocol=ret["protocol"], + numpy=numpy, ), poolclass=NullPool, ) @@ -192,6 +193,13 @@ def engine_testaccount(request): return engine +@pytest.fixture() +def engine_testaccount_with_numpy(request): + engine, _ = get_engine(numpy=True) + request.addfinalizer(engine.dispose) + return engine + + @pytest.fixture(scope="session", autouse=True) def init_test_schema(request, db_parameters): ret = db_parameters diff --git a/tests/test_pandas.py b/tests/test_pandas.py index 3d1365a9..5b796c2f 100644 --- a/tests/test_pandas.py +++ b/tests/test_pandas.py @@ -24,7 +24,6 @@ select, text, ) -from sqlalchemy.pool import NullPool from snowflake.connector import ProgrammingError from snowflake.connector.pandas_tools import make_pd_writer, pd_writer @@ -113,40 +112,8 @@ def test_a_simple_read_sql(engine_testaccount): users.drop(engine_testaccount) -def get_engine_with_numpy(db_parameters, user=None, password=None, account=None): - """ - Creates a connection using the parameters defined in JDBC connect string - """ - from snowflake.sqlalchemy import URL - - if user is not None: - db_parameters["user"] = user - if password is not None: - db_parameters["password"] = password - if account is not None: - db_parameters["account"] = account - - engine = create_engine( - URL( - user=db_parameters["user"], - password=db_parameters["password"], - host=db_parameters["host"], - port=db_parameters["port"], - database=db_parameters["database"], - schema=db_parameters["schema"], - account=db_parameters["account"], - protocol=db_parameters["protocol"], - numpy=True, - ), - poolclass=NullPool, - ) - - return engine - - -def test_numpy_datatypes(db_parameters): - engine = get_engine_with_numpy(db_parameters) - with engine.connect() as conn: +def test_numpy_datatypes(engine_testaccount_with_numpy, db_parameters): + with engine_testaccount_with_numpy.connect() as conn: try: specific_date = np.datetime64("2016-03-04T12:03:05.123456789") with conn.begin(): @@ -163,12 +130,11 @@ def test_numpy_datatypes(db_parameters): assert df.c1.values[0] == specific_date finally: conn.exec_driver_sql(f"DROP TABLE IF EXISTS {db_parameters['name']}") - engine.dispose() + engine_testaccount_with_numpy.dispose() -def test_to_sql(db_parameters): - engine = get_engine_with_numpy(db_parameters) - with engine.connect() as conn: +def test_to_sql(engine_testaccount_with_numpy, db_parameters): + with engine_testaccount_with_numpy.connect() as conn: total_rows = 10000 conn.exec_driver_sql( textwrap.dedent( @@ -182,7 +148,13 @@ def test_to_sql(db_parameters): conn.exec_driver_sql("create or replace table dst(c1 float)") tbl = pd.read_sql_query(text("select * from src"), conn) - tbl.to_sql("dst", engine, if_exists="append", chunksize=1000, index=False) + tbl.to_sql( + "dst", + engine_testaccount_with_numpy, + if_exists="append", + chunksize=1000, + index=False, + ) df = pd.read_sql_query(text("select count(*) as cnt from dst"), conn) assert df.cnt.values[0] == total_rows @@ -299,13 +271,13 @@ def test_timezone(db_parameters): @pytest.mark.flaky(reruns=3, reruns_delay=7) @pytest.mark.timeout(45) -def test_pandas_writeback(engine_testaccount, run_v20_sqlalchemy): +def test_pandas_writeback(engine_testaccount_with_numpy, run_v20_sqlalchemy): if run_v20_sqlalchemy and sys.version_info < (3, 8): pytest.skip( "In Python 3.7, this test depends on pandas features of which the implementation is incompatible with sqlachemy 2.0, and pandas does not support Python 3.7 anymore." ) - with engine_testaccount.connect() as conn: + with engine_testaccount_with_numpy.connect() as conn: sf_connector_version_data = [ ("snowflake-connector-python", "1.2.23"), ("snowflake-sqlalchemy", "1.1.1"), @@ -319,17 +291,10 @@ def test_pandas_writeback(engine_testaccount, run_v20_sqlalchemy): sf_connector_version_data, columns=["NAME", "NEWEST_VERSION"] ) sf_connector_version_df.to_sql(table_name, conn, index=False, method=pd_writer) - - assert ( - ( - pd.read_sql_table(table_name, conn).rename( - columns={"newest_version": "NEWEST_VERSION", "name": "NAME"} - ) - == sf_connector_version_df - ) - .all() - .all() + results = pd.read_sql_table(table_name, conn).rename( + columns={"newest_version": "NEWEST_VERSION", "name": "NAME"} ) + assert results.equals(sf_connector_version_df) @pytest.mark.parametrize("chunk_size", [5, 1]) From 4b69f5a34344943d753e7a2e8605ed4ecdbcbb9e Mon Sep 17 00:00:00 2001 From: Marcin Raba Date: Thu, 14 Mar 2024 15:12:55 +0100 Subject: [PATCH 16/19] SNOW-1065172-gh-workflow-optimization: replace table if exists test_pandas_writeback Sometimes on GCP this test stalls. Until we figure out what is the real prblem we will retry and add timeout. --- tests/test_pandas.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_pandas.py b/tests/test_pandas.py index 5b796c2f..1678adab 100644 --- a/tests/test_pandas.py +++ b/tests/test_pandas.py @@ -269,15 +269,13 @@ def test_timezone(db_parameters): conn.exec_driver_sql(f"DROP TABLE {test_table_name};") -@pytest.mark.flaky(reruns=3, reruns_delay=7) -@pytest.mark.timeout(45) -def test_pandas_writeback(engine_testaccount_with_numpy, run_v20_sqlalchemy): +def test_pandas_writeback(engine_testaccount, run_v20_sqlalchemy): if run_v20_sqlalchemy and sys.version_info < (3, 8): pytest.skip( "In Python 3.7, this test depends on pandas features of which the implementation is incompatible with sqlachemy 2.0, and pandas does not support Python 3.7 anymore." ) - with engine_testaccount_with_numpy.connect() as conn: + with engine_testaccount.connect() as conn: sf_connector_version_data = [ ("snowflake-connector-python", "1.2.23"), ("snowflake-sqlalchemy", "1.1.1"), @@ -290,7 +288,9 @@ def test_pandas_writeback(engine_testaccount_with_numpy, run_v20_sqlalchemy): sf_connector_version_df = pd.DataFrame( sf_connector_version_data, columns=["NAME", "NEWEST_VERSION"] ) - sf_connector_version_df.to_sql(table_name, conn, index=False, method=pd_writer) + sf_connector_version_df.to_sql( + table_name, conn, index=False, method=pd_writer, if_exists="replace" + ) results = pd.read_sql_table(table_name, conn).rename( columns={"newest_version": "NEWEST_VERSION", "name": "NAME"} ) From 328d193aa41c6c11305ac478e5ac782e4bc3f612 Mon Sep 17 00:00:00 2001 From: Adam Stus Date: Thu, 14 Mar 2024 17:12:01 +0100 Subject: [PATCH 17/19] Run single test --- .github/workflows/build_test.yml | 190 +++++++++++++++---------------- pyproject.toml | 2 +- 2 files changed, 94 insertions(+), 98 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 1a8eb727..3e729ecf 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -54,15 +54,11 @@ jobs: fail-fast: false matrix: os: [ - ubuntu-latest, macos-latest, - windows-latest, ] python-version: ["3.8"] cloud-provider: [ - aws, - azure, - gcp, + gcp ] steps: - uses: actions/checkout@v4 @@ -92,96 +88,96 @@ jobs: path: | ./coverage.xml - test-dialect-compatibility: - name: Test dialect compatibility ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - # needs: test-dialect - needs: lint - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ - ubuntu-latest, - macos-latest, - windows-latest, - ] - python-version: ["3.8"] - cloud-provider: [ - aws, - azure, - gcp, - ] - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Upgrade pip and install hatch - run: | - python -m pip install -U pip - python -m pip install -U hatch - python -m hatch env create default - - name: Setup parameters file - shell: bash - env: - PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} - run: | - gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ - .github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py - - name: Run tests - run: hatch run test-dialect-compatibility - - uses: actions/upload-artifact@v4 - with: - name: coverage.xml_dialect-compatibility-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - path: | - ./coverage.xml +# test-dialect-compatibility: +# name: Test dialect compatibility ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} +# # needs: test-dialect +# needs: lint +# runs-on: ${{ matrix.os }} +# strategy: +# fail-fast: false +# matrix: +# os: [ +# ubuntu-latest, +# macos-latest, +# windows-latest, +# ] +# python-version: ["3.8"] +# cloud-provider: [ +# aws, +# azure, +# gcp, +# ] +# steps: +# - uses: actions/checkout@v4 +# with: +# persist-credentials: false +# - name: Set up Python +# uses: actions/setup-python@v5 +# with: +# python-version: ${{ matrix.python-version }} +# - name: Upgrade pip and install hatch +# run: | +# python -m pip install -U pip +# python -m pip install -U hatch +# python -m hatch env create default +# - name: Setup parameters file +# shell: bash +# env: +# PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} +# run: | +# gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ +# .github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py +# - name: Run tests +# run: hatch run test-dialect-compatibility +# - uses: actions/upload-artifact@v4 +# with: +# name: coverage.xml_dialect-compatibility-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} +# path: | +# ./coverage.xml - test-dialect-run-v20: - name: Test dialect run v20 ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - # needs: test-dialect - needs: lint - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ - ubuntu-latest, - macos-latest, - windows-latest, - ] - python-version: ["3.8"] - cloud-provider: [ - aws, - azure, - gcp, - ] - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Setup parameters file - shell: bash - env: - PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} - run: | - gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ - .github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py - - name: Upgrade pip and install hatch - run: | - python -m pip install -U pip - python -m pip install -U hatch - python -m hatch env create default - - name: Run tests - run: hatch run test-run_v20 - - uses: actions/upload-artifact@v4 - with: - name: coverage.xml_dialect-run-20-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - path: | - ./coverage.xml +# test-dialect-run-v20: +# name: Test dialect run v20 ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} +# # needs: test-dialect +# needs: lint +# runs-on: ${{ matrix.os }} +# strategy: +# fail-fast: false +# matrix: +# os: [ +# ubuntu-latest, +# macos-latest, +# windows-latest, +# ] +# python-version: ["3.8"] +# cloud-provider: [ +# aws, +# azure, +# gcp, +# ] +# steps: +# - uses: actions/checkout@v4 +# with: +# persist-credentials: false +# - name: Set up Python +# uses: actions/setup-python@v5 +# with: +# python-version: ${{ matrix.python-version }} +# - name: Setup parameters file +# shell: bash +# env: +# PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }} +# run: | +# gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" \ +# .github/workflows/parameters/parameters_${{ matrix.cloud-provider }}.py.gpg > tests/parameters.py +# - name: Upgrade pip and install hatch +# run: | +# python -m pip install -U pip +# python -m pip install -U hatch +# python -m hatch env create default +# - name: Run tests +# run: hatch run test-run_v20 +# - uses: actions/upload-artifact@v4 +# with: +# name: coverage.xml_dialect-run-20-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} +# path: | +# ./coverage.xml diff --git a/pyproject.toml b/pyproject.toml index 8707fae3..345ec4c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,7 +87,7 @@ SQLACHEMY_WARN_20 = "1" [tool.hatch.envs.default.scripts] check = "pre-commit run --all-files" -test-dialect = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite" +test-dialect = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite tests/test_pandas.py::test_pandas_writeback" test-dialect-compatibility = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml tests/sqlalchemy_test_suite" test-run_v20 = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite --run_v20_sqlalchemy" gh-cache-sum = "python -VV | sha256sum | cut -d' ' -f1" From 2285829bda5b8eab347d6647c678b0d842b1008c Mon Sep 17 00:00:00 2001 From: Adam Stus Date: Thu, 14 Mar 2024 17:28:11 +0100 Subject: [PATCH 18/19] Run single test --- .github/workflows/build_test.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 3e729ecf..0f520a9f 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -48,7 +48,7 @@ jobs: test-dialect: name: Test dialect ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }} - needs: lint +# needs: lint runs-on: ${{ matrix.os }} strategy: fail-fast: false diff --git a/pyproject.toml b/pyproject.toml index 345ec4c9..8b0b4623 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,7 +87,7 @@ SQLACHEMY_WARN_20 = "1" [tool.hatch.envs.default.scripts] check = "pre-commit run --all-files" -test-dialect = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite tests/test_pandas.py::test_pandas_writeback" +test-dialect = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite tests/test_pandas.py" test-dialect-compatibility = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml tests/sqlalchemy_test_suite" test-run_v20 = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite --run_v20_sqlalchemy" gh-cache-sum = "python -VV | sha256sum | cut -d' ' -f1" From 8ee415f38e4234772b5001a367d1671b11d0478c Mon Sep 17 00:00:00 2001 From: Adam Stus Date: Thu, 14 Mar 2024 18:42:24 +0100 Subject: [PATCH 19/19] Run single test --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8b0b4623..8707fae3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,7 +87,7 @@ SQLACHEMY_WARN_20 = "1" [tool.hatch.envs.default.scripts] check = "pre-commit run --all-files" -test-dialect = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite tests/test_pandas.py" +test-dialect = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite" test-dialect-compatibility = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml tests/sqlalchemy_test_suite" test-run_v20 = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite --run_v20_sqlalchemy" gh-cache-sum = "python -VV | sha256sum | cut -d' ' -f1"