Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ docker compose up -d
pip install uv

# Use a workspace-local virtualenv so package installs do not fail on user permissions.
uv pip install -r dev_requirements.txt
uv pip install -e . --group dev
source .venv/bin/activate
pre-commit install
46 changes: 46 additions & 0 deletions .github/scripts/verify_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env python3
"""Verify the packaged version matches the release git tag.

Usage:
python .github/scripts/verify_version.py <tag>

The tag typically comes from ``$GITHUB_REF_NAME`` and may be prefixed with
``v`` (e.g. ``v1.9.1``). The leading ``v`` is stripped before comparison.

Exits 0 on match, 1 on mismatch, 2 on usage error.
"""
from __future__ import annotations

import re
import sys
from pathlib import Path

REPO_ROOT = Path(__file__).resolve().parents[2]
VERSION_FILE = REPO_ROOT / "dbt" / "adapters" / "sqlserver" / "__version__.py"
VERSION_RE = re.compile(r"""version\s*=\s*["'](?P<version>.+?)["']""")


def read_package_version(version_file: Path = VERSION_FILE) -> str:
match = VERSION_RE.search(version_file.read_text())
if not match:
raise ValueError(f"could not find version in {version_file}")
return match.group("version")


def main(argv: list[str]) -> int:
if len(argv) != 2:
print("usage: verify_version.py <tag>", file=sys.stderr)
return 2
tag_version = argv[1].lstrip("v")
pkg_version = read_package_version()
if tag_version != pkg_version:
print(
f"Git tag {tag_version!r} does not match " f"package version {pkg_version!r}",
file=sys.stderr,
)
return 1
return 0


if __name__ == "__main__":
sys.exit(main(sys.argv))
12 changes: 2 additions & 10 deletions .github/workflows/integration-tests-sqlserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ on: # yamllint disable-line rule:truthy
- 'tests/functional/**'
- 'devops/**'
- 'docker-compose.yml'
- 'dev_requirements.txt'
- '**/*.lock'
- '.locks/**'
- 'pyproject.toml'
- 'setup.cfg'
- 'setup.py'
- 'MANIFEST.in'
- 'pytest.ini'
- '.github/workflows/integration-tests-sqlserver.yml'
pull_request:
Expand All @@ -29,13 +25,9 @@ on: # yamllint disable-line rule:truthy
- 'tests/functional/**'
- 'devops/**'
- 'docker-compose.yml'
- 'dev_requirements.txt'
- '**/*.lock'
- '.locks/**'
- 'pyproject.toml'
- 'setup.cfg'
- 'setup.py'
- 'MANIFEST.in'
- 'pytest.ini'
- '.github/workflows/integration-tests-sqlserver.yml'
schedule:
Expand All @@ -46,7 +38,7 @@ jobs:
name: Regular
strategy:
matrix:
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python_version: ["3.10", "3.11", "3.12", "3.13"]
msodbc_version: ["17", "18"]
sqlserver_version: ["2017", "2019", "2022"]
collation: ["SQL_Latin1_General_CP1_CS_AS", "SQL_Latin1_General_CP1_CI_AS"]
Expand All @@ -70,7 +62,7 @@ jobs:
run: pip install uv

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

- name: Run functional tests
run: pytest -ra -v tests/functional --profile "ci_sql_server"
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/release-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@ jobs:

- uses: actions/setup-python@v6
with:
python-version: '3.9'
python-version: '3.10'

- name: Install uv
run: pip install uv
- name: Install build tooling
run: pip install build twine

- name: Install dependencies
run: uv pip install --system -r dev_requirements.txt

- name: Verify version match
run: python setup.py verify
- name: Verify version matches tag
Comment thread
axellpadilla marked this conversation as resolved.
run: python .github/scripts/verify_version.py "${{ github.ref_name }}"

- name: Initialize .pypirc
run: |
Expand All @@ -34,5 +31,5 @@ jobs:

- name: Build and publish package
run: |
python setup.py sdist bdist_wheel
python -m build
twine upload dist/*
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: Unit tests
strategy:
matrix:
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python_version: ["3.10", "3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -36,7 +36,7 @@ jobs:
run: pip install uv

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

- name: Run unit tests
run: pytest -n auto -ra -v tests/unit
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ THREADS ?= auto
.PHONY: dev
dev: ## Installs adapter in develop mode along with development dependencies
@\
uv pip install -r dev_requirements.txt && pre-commit install
uv pip install -e . --group dev && pre-commit install

.PHONY: mypy
mypy: ## Runs mypy against staged changes for static type checking.
Expand Down
Empty file added dbt/adapters/sqlserver/py.typed
Empty file.
24 changes: 0 additions & 24 deletions dev_requirements.txt

This file was deleted.

81 changes: 81 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "dbt-sqlserver"
description = "A Microsoft SQL Server adapter plugin for dbt"
readme = "README.md"
license = { text = "MIT" }
authors = [
{ name = "Mikael Ene" },
{ name = "Anders Swanson" },
{ name = "Sam Debruyn" },
{ name = "Cor Zuurmond" },
{ name = "Cody Scott" },
]
requires-python = ">=3.10"
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = [
"dbt-core>=1.9.0,<2.0",
"dbt-common>=1.0,<2.0",
"dbt-adapters>=1.11.0,<2.0",
]
dynamic = ["version"]

[project.optional-dependencies]
azure = [
"azure-identity>=1.12.0",
]
pyodbc = [
"pyodbc>=5.2.0",
]

Comment thread
axellpadilla marked this conversation as resolved.
[dependency-groups]
dev = [
Comment thread
axellpadilla marked this conversation as resolved.
"dbt-tests-adapter>=1.9.0,<2.0",
"azure-identity>=1.12.0",
"build",
"bumpversion",
"flaky",
"freezegun==1.4.0",
"ipdb",
"mypy==1.11.2",
"pre-commit",
"pytest",
"pytest-csv",
"pytest-dotenv",
"pytest-xdist",
"pytz",
"ruff",
"tox>=3.13",
"twine",
]

[project.urls]
"Setup & configuration" = "https://docs.getdbt.com/reference/warehouse-profiles/mssql-profile"
"Documentation & usage" = "https://docs.getdbt.com/reference/resource-configs/mssql-configs"
"Changelog" = "https://github.com/dbt-msft/dbt-sqlserver/blob/master/CHANGELOG.md"
"Issue Tracker" = "https://github.com/dbt-msft/dbt-sqlserver/issues"
"Source" = "https://github.com/dbt-msft/dbt-sqlserver"

[tool.setuptools.dynamic]
version = { attr = "dbt.adapters.sqlserver.__version__.version" }

[tool.setuptools.packages.find]
include = ["dbt", "dbt.*"]
namespaces = true

[tool.setuptools.package-data]
"dbt" = ["include/**/*.sql", "include/**/*.yml", "include/**/*.md"]
"dbt.adapters.sqlserver" = ["py.typed"]
95 changes: 0 additions & 95 deletions setup.py

This file was deleted.