Skip to content

Commit 1d93b9a

Browse files
authored
Merge branch 'master' into view_materialization_improvement
2 parents 19d344b + f15aee4 commit 1d93b9a

78 files changed

Lines changed: 4361 additions & 383 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: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,23 @@
22
"name": "Python 3",
33
"image": "mcr.microsoft.com/devcontainers/python:3.10-bookworm",
44
"features": {
5-
"ghcr.io/devcontainers/features/docker-in-docker:2.17.0": {}
5+
"ghcr.io/devcontainers/features/docker-in-docker:2.17.0": {
6+
"moby": false
7+
}
68
},
7-
"forwardPorts": [1433],
9+
"forwardPorts": [
10+
1433
11+
],
812
"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+
}
21+
},
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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ docker compose up -d
99
pip install uv
1010

1111
# Use a workspace-local virtualenv so package installs do not fail on user permissions.
12-
uv pip install -r dev_requirements.txt
12+
[ -d .venv ] || uv venv
1313
source .venv/bin/activate
14+
15+
uv sync --group dev --extra pyodbc
1416
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: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
13+
from __future__ import annotations
14+
15+
import re
16+
import sys
17+
from pathlib import Path
18+
19+
REPO_ROOT = Path(__file__).resolve().parents[2]
20+
VERSION_FILE = REPO_ROOT / "dbt" / "adapters" / "sqlserver" / "__version__.py"
21+
VERSION_RE = re.compile(r"""version\s*=\s*["'](?P<version>.+?)["']""")
22+
23+
24+
def read_package_version(version_file: Path = VERSION_FILE) -> str:
25+
match = VERSION_RE.search(version_file.read_text())
26+
if not match:
27+
raise ValueError(f"could not find version in {version_file}")
28+
return match.group("version")
29+
30+
31+
def main(argv: list[str]) -> int:
32+
if len(argv) != 2:
33+
print("usage: verify_version.py <tag>", file=sys.stderr)
34+
return 2
35+
tag_version = argv[1].lstrip("v")
36+
pkg_version = read_package_version()
37+
if tag_version != pkg_version:
38+
print(
39+
f"Git tag {tag_version!r} does not match " f"package version {pkg_version!r}",
40+
file=sys.stderr,
41+
)
42+
return 1
43+
return 0
44+
45+
46+
if __name__ == "__main__":
47+
sys.exit(main(sys.argv))

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@ on: # yamllint disable-line rule:truthy
1111
- 'tests/functional/**'
1212
- 'devops/**'
1313
- 'docker-compose.yml'
14-
- 'dev_requirements.txt'
1514
- '**/*.lock'
1615
- '.locks/**'
1716
- 'pyproject.toml'
18-
- 'setup.cfg'
19-
- 'setup.py'
20-
- 'MANIFEST.in'
2117
- 'pytest.ini'
2218
- '.github/workflows/integration-tests-sqlserver.yml'
2319
pull_request:
@@ -29,13 +25,9 @@ on: # yamllint disable-line rule:truthy
2925
- 'tests/functional/**'
3026
- 'devops/**'
3127
- 'docker-compose.yml'
32-
- 'dev_requirements.txt'
3328
- '**/*.lock'
3429
- '.locks/**'
3530
- 'pyproject.toml'
36-
- 'setup.cfg'
37-
- 'setup.py'
38-
- 'MANIFEST.in'
3931
- 'pytest.ini'
4032
- '.github/workflows/integration-tests-sqlserver.yml'
4133
schedule:
@@ -44,9 +36,10 @@ on: # yamllint disable-line rule:truthy
4436
jobs:
4537
integration-tests-sql-server:
4638
name: Regular
39+
if: github.actor != 'dependabot[bot]'
4740
strategy:
4841
matrix:
49-
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
42+
python_version: ["3.10", "3.11", "3.12", "3.13"]
5043
msodbc_version: ["17", "18"]
5144
sqlserver_version: ["2017", "2019", "2022"]
5245
collation: ["SQL_Latin1_General_CP1_CS_AS", "SQL_Latin1_General_CP1_CI_AS"]
@@ -70,7 +63,7 @@ jobs:
7063
run: pip install uv
7164

7265
- name: Install dependencies
73-
run: uv pip install --system -r dev_requirements.txt
66+
run: uv pip install --system -e ".[pyodbc]" --group dev
7467

7568
- name: Run functional tests
7669
run: pytest -ra -v tests/functional --profile "ci_sql_server"

.github/workflows/publish-docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
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 }}
@@ -53,7 +53,7 @@ jobs:
5353
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: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,15 @@ jobs:
1313
steps:
1414
- 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 uv
21-
run: pip install uv
20+
- name: Install build tooling
21+
run: pip install build twine
2222

23-
- name: Install dependencies
24-
run: uv pip install --system -r dev_requirements.txt
25-
26-
- name: Verify version match
27-
run: python setup.py verify
23+
- name: Verify version matches tag
24+
run: python .github/scripts/verify_version.py "${{ github.ref_name }}"
2825

2926
- name: Initialize .pypirc
3027
run: |
@@ -34,5 +31,5 @@ jobs:
3431
3532
- name: Build and publish package
3633
run: |
37-
python setup.py sdist bdist_wheel
34+
python -m build
3835
twine upload dist/*

.github/workflows/unit-tests.yml

Lines changed: 2 additions & 2 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", "3.13"]
21+
python_version: ["3.10", "3.11", "3.12", "3.13"]
2222
runs-on: ubuntu-latest
2323
permissions:
2424
contents: read
@@ -36,7 +36,7 @@ jobs:
3636
run: pip install uv
3737

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

4141
- name: Run unit tests
4242
run: pytest -n auto -ra -v tests/unit

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ default_language_version:
22
python: python3.10
33
repos:
44
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
5-
rev: v4.6.0
5+
rev: v6.0.0
66
hooks:
77
- id: check-yaml
88
args:
@@ -21,7 +21,7 @@ repos:
2121
- id: mixed-line-ending
2222
- id: check-docstring-first
2323
- repo: 'https://github.com/adrienverge/yamllint'
24-
rev: v1.35.1
24+
rev: v1.38.0
2525
hooks:
2626
- id: yamllint
2727
args:
@@ -38,7 +38,7 @@ repos:
3838
args:
3939
- '--all'
4040
- repo: 'https://github.com/pycqa/isort'
41-
rev: 5.13.2
41+
rev: 9.0.0a3
4242
hooks:
4343
- id: isort
4444
args:
@@ -50,7 +50,7 @@ repos:
5050
- '--python-version'
5151
- '39'
5252
- repo: 'https://github.com/psf/black'
53-
rev: 24.8.0
53+
rev: 26.5.1
5454
hooks:
5555
- id: black
5656
args:
@@ -66,7 +66,7 @@ repos:
6666
- '--check'
6767
- '--diff'
6868
- repo: 'https://github.com/pycqa/flake8'
69-
rev: 7.1.1
69+
rev: 7.3.0
7070
hooks:
7171
- id: flake8
7272
args:
@@ -78,7 +78,7 @@ repos:
7878
stages:
7979
- manual
8080
- repo: 'https://github.com/pre-commit/mirrors-mypy'
81-
rev: v1.11.1
81+
rev: v2.1.0
8282
hooks:
8383
- id: mypy
8484
args:

0 commit comments

Comments
 (0)