Skip to content

Commit e44d2ee

Browse files
authored
Merge branch 'master' into disable_alias
2 parents c84d436 + 57e8808 commit e44d2ee

124 files changed

Lines changed: 8068 additions & 504 deletions

File tree

Some content is hidden

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

.devcontainer/devcontainer.json

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
{
22
"name": "Python 3",
3-
"image": "mcr.microsoft.com/devcontainers/python:1-3.10-bookworm",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.10-bookworm",
44
"features": {
5-
"ghcr.io/devcontainers/features/docker-in-docker:2.12.0": {}
5+
"ghcr.io/devcontainers/features/docker-in-docker:2.17.0": {
6+
"moby": false
7+
}
8+
},
9+
"forwardPorts": [
10+
1433
11+
],
12+
"postStartCommand": "/bin/bash ./.devcontainer/setup_odbc.sh && /bin/bash ./.devcontainer/setup_env.sh",
13+
"customizations": {
14+
"vscode": {
15+
"settings": {
16+
"python-envs.alwaysUseUv": true,
17+
"python-envs.terminal.autoActivationType": "shellStartup",
18+
"python.defaultInterpreterPath": "${containerWorkspaceFolder}/.venv/bin/python"
19+
}
20+
}
621
},
7-
"forwardPorts": [1433],
8-
"postStartCommand": "/bin/bash ./.devcontainer/setup_odbc.sh & /bin/bash ./.devcontainer/setup_env.sh",
922
"containerEnv": {
1023
"SQLSERVER_TEST_DRIVER": "ODBC Driver 18 for SQL Server",
1124
"SQLSERVER_TEST_HOST": "127.0.0.1",

.devcontainer/setup_env.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
set -euo pipefail
2+
13
cp test.env.sample test.env
24

35
docker compose build
46
docker compose up -d
57

6-
pip install -r dev_requirements.txt
8+
# Install uv in the container user environment.
9+
pip install uv
10+
11+
# Use a workspace-local virtualenv so package installs do not fail on user permissions.
12+
[ -d .venv ] || uv venv
13+
source .venv/bin/activate
14+
15+
uv sync --group dev --extra pyodbc
16+
pre-commit install

.devcontainer/setup_odbc.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
1+
curl https://packages.microsoft.com/keys/microsoft.asc \
2+
| gpg --dearmor \
3+
| sudo tee /usr/share/keyrings/microsoft-prod.gpg >/dev/null
24

35
#Download appropriate package for the OS version
46
#Choose only ONE of the following, corresponding to your OS version

.github/dependabot.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,46 @@
1-
---
21
version: 2
2+
33
updates:
4-
- package-ecosystem: pip
4+
- package-ecosystem: "pip"
55
directory: "/"
66
schedule:
7-
interval: daily
8-
- package-ecosystem: github-actions
7+
interval: "weekly"
8+
groups:
9+
pip-updates:
10+
applies-to: "version-updates"
11+
patterns:
12+
- "*"
13+
pip-security:
14+
applies-to: "security-updates"
15+
patterns:
16+
- "*"
17+
18+
- package-ecosystem: "github-actions"
919
directory: "/"
1020
schedule:
11-
interval: daily
12-
- package-ecosystem: docker
13-
directory: "/"
21+
interval: "weekly"
22+
groups:
23+
github-actions-updates:
24+
applies-to: "version-updates"
25+
patterns:
26+
- "*"
27+
github-actions-security:
28+
applies-to: "security-updates"
29+
patterns:
30+
- "*"
31+
32+
- package-ecosystem: "docker"
33+
directories:
34+
- "/"
35+
- "/devops"
1436
schedule:
15-
interval: daily
37+
interval: "weekly"
38+
groups:
39+
docker-updates:
40+
applies-to: "version-updates"
41+
patterns:
42+
- "*"
43+
docker-security:
44+
applies-to: "security-updates"
45+
patterns:
46+
- "*"

.github/scripts/verify_version.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env python3
2+
"""Verify the packaged version matches the release git tag.
3+
4+
Usage:
5+
python .github/scripts/verify_version.py <tag>
6+
7+
The tag typically comes from ``$GITHUB_REF_NAME`` and may be prefixed with
8+
``v`` (e.g. ``v1.9.1``). The leading ``v`` is stripped before comparison.
9+
10+
Exits 0 on match, 1 on mismatch, 2 on usage error.
11+
"""
12+
from __future__ import annotations
13+
14+
import re
15+
import sys
16+
from pathlib import Path
17+
18+
REPO_ROOT = Path(__file__).resolve().parents[2]
19+
VERSION_FILE = REPO_ROOT / "dbt" / "adapters" / "sqlserver" / "__version__.py"
20+
VERSION_RE = re.compile(r"""version\s*=\s*["'](?P<version>.+?)["']""")
21+
22+
23+
def read_package_version(version_file: Path = VERSION_FILE) -> str:
24+
match = VERSION_RE.search(version_file.read_text())
25+
if not match:
26+
raise ValueError(f"could not find version in {version_file}")
27+
return match.group("version")
28+
29+
30+
def main(argv: list[str]) -> int:
31+
if len(argv) != 2:
32+
print("usage: verify_version.py <tag>", file=sys.stderr)
33+
return 2
34+
tag_version = argv[1].lstrip("v")
35+
pkg_version = read_package_version()
36+
if tag_version != pkg_version:
37+
print(
38+
f"Git tag {tag_version!r} does not match " f"package version {pkg_version!r}",
39+
file=sys.stderr,
40+
)
41+
return 1
42+
return 0
43+
44+
45+
if __name__ == "__main__":
46+
sys.exit(main(sys.argv))

.github/workflows/integration-tests-sqlserver.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,40 @@ on: # yamllint disable-line rule:truthy
66
branches:
77
- master
88
- v*
9+
paths:
10+
- 'dbt/**'
11+
- 'tests/functional/**'
12+
- 'devops/**'
13+
- 'docker-compose.yml'
14+
- '**/*.lock'
15+
- '.locks/**'
16+
- 'pyproject.toml'
17+
- 'pytest.ini'
18+
- '.github/workflows/integration-tests-sqlserver.yml'
919
pull_request:
1020
branches:
1121
- master
1222
- v*
23+
paths:
24+
- 'dbt/**'
25+
- 'tests/functional/**'
26+
- 'devops/**'
27+
- 'docker-compose.yml'
28+
- '**/*.lock'
29+
- '.locks/**'
30+
- 'pyproject.toml'
31+
- 'pytest.ini'
32+
- '.github/workflows/integration-tests-sqlserver.yml'
1333
schedule:
1434
- cron: '0 22 * * 0'
1535

1636
jobs:
1737
integration-tests-sql-server:
1838
name: Regular
39+
if: github.actor != 'dependabot[bot]'
1940
strategy:
2041
matrix:
21-
python_version: ["3.9", "3.10", "3.11", "3.12"]
42+
python_version: ["3.10", "3.11", "3.12", "3.13"]
2243
msodbc_version: ["17", "18"]
2344
sqlserver_version: ["2017", "2019", "2022"]
2445
collation: ["SQL_Latin1_General_CP1_CS_AS", "SQL_Latin1_General_CP1_CI_AS"]
@@ -36,10 +57,13 @@ jobs:
3657
DBT_TEST_USER_3: DBT_TEST_USER_3
3758
COLLATION: ${{ matrix.collation }}
3859
steps:
39-
- uses: actions/checkout@v4
60+
- uses: actions/checkout@v6
61+
62+
- name: Install uv
63+
run: pip install uv
4064

4165
- name: Install dependencies
42-
run: pip install -r dev_requirements.txt
66+
run: uv pip install --system -e ".[pyodbc]" --group dev
4367

4468
- name: Run functional tests
4569
run: pytest -ra -v tests/functional --profile "ci_sql_server"

.github/workflows/publish-docker.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ jobs:
1212
publish-docker-client:
1313
strategy:
1414
matrix:
15-
python_version: ["3.9", "3.10", "3.11", "3.12"]
15+
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1616
docker_target: ["msodbc17", "msodbc18"]
1717
runs-on: ubuntu-latest
1818
permissions:
1919
contents: read
2020
packages: write
2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@v6
2424

2525
- name: Log in to the Container registry
26-
uses: docker/login-action@v3.3.0
26+
uses: docker/login-action@v4.1.0
2727
with:
2828
registry: ghcr.io
2929
username: ${{ github.actor }}
@@ -50,10 +50,10 @@ jobs:
5050
packages: write
5151
steps:
5252
- name: Checkout
53-
uses: actions/checkout@v4
53+
uses: actions/checkout@v6
5454

5555
- name: Log in to the Container registry
56-
uses: docker/login-action@v3.3.0
56+
uses: docker/login-action@v4.1.0
5757
with:
5858
registry: ghcr.io
5959
username: ${{ github.actor }}

.github/workflows/release-version.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ jobs:
1111
name: Release new version
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v6
1515

16-
- uses: actions/setup-python@v5
16+
- uses: actions/setup-python@v6
1717
with:
18-
python-version: '3.9'
18+
python-version: '3.10'
1919

20-
- name: Install dependencies
21-
run: pip install -r dev_requirements.txt
20+
- name: Install build tooling
21+
run: pip install build twine
2222

23-
- name: Verify version match
24-
run: python setup.py verify
23+
- name: Verify version matches tag
24+
run: python .github/scripts/verify_version.py "${{ github.ref_name }}"
2525

2626
- name: Initialize .pypirc
2727
run: |
@@ -31,5 +31,5 @@ jobs:
3131
3232
- name: Build and publish package
3333
run: |
34-
python setup.py sdist bdist_wheel
34+
python -m build
3535
twine upload dist/*

.github/workflows/unit-tests.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
name: Unit tests
1919
strategy:
2020
matrix:
21-
python_version: ["3.9", "3.10", "3.11", "3.12"]
21+
python_version: ["3.10", "3.11", "3.12", "3.13"]
2222
runs-on: ubuntu-latest
2323
permissions:
2424
contents: read
@@ -30,10 +30,13 @@ jobs:
3030
password: ${{ secrets.github_token }}
3131
steps:
3232

33-
- uses: actions/checkout@v4
33+
- uses: actions/checkout@v6
34+
35+
- name: Install uv
36+
run: pip install uv
3437

3538
- name: Install dependencies
36-
run: pip install -r dev_requirements.txt
39+
run: uv pip install --system -e ".[pyodbc]" --group dev
3740

3841
- name: Run unit tests
3942
run: pytest -n auto -ra -v tests/unit

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ repos:
3232
hooks:
3333
- id: absolufy-imports
3434
- repo: 'https://github.com/hadialqattan/pycln'
35-
rev: v2.5.0
35+
rev: v2.6.0
3636
hooks:
3737
- id: pycln
3838
args:

0 commit comments

Comments
 (0)