Skip to content

Commit 09b577b

Browse files
authored
Merge pull request #513 from cody-scott/1.8-and-tests
DBT 1.8 and test coverage updates
2 parents f789ab0 + e7d908b commit 09b577b

File tree

94 files changed

+3728
-2091
lines changed

Some content is hidden

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

94 files changed

+3728
-2091
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"features": {
55
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
66
},
7-
"postStartCommand": "sudo bash .devcontainer/setup_odbc.sh && bash .devcontainer/install_pyenv.sh && bash .devcontainer/setup_env.sh",
7+
"forwardPorts": [1433],
8+
"postStartCommand": "/bin/bash ./.devcontainer/setup_odbc.sh & /bin/bash ./.devcontainer/setup_env.sh",
89
"containerEnv": {
910
"SQLSERVER_TEST_DRIVER": "ODBC Driver 18 for SQL Server",
1011
"SQLSERVER_TEST_HOST": "127.0.0.1",

.devcontainer/setup_env.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
cp test.env.sample test.env
22

3-
pyenv install 3.10.7
4-
pyenv virtualenv 3.10.7 dbt-sqlserver
5-
pyenv activate dbt-sqlserver
3+
docker compose build
4+
docker compose up -d
65

7-
make dev
8-
make server
6+
pip install -r dev_requirements.txt

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,5 @@ ENV/
9696
env.bak/
9797
venv.bak/
9898
.mise.toml
99+
100+
**devcontainer-lock.json**

.pre-commit-config.yaml

Lines changed: 7 additions & 7 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.4.0
5+
rev: v4.6.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.32.0
24+
rev: v1.35.1
2525
hooks:
2626
- id: yamllint
2727
args:
@@ -32,13 +32,13 @@ repos:
3232
hooks:
3333
- id: absolufy-imports
3434
- repo: 'https://github.com/hadialqattan/pycln'
35-
rev: v2.1.3
35+
rev: v2.4.0
3636
hooks:
3737
- id: pycln
3838
args:
3939
- '--all'
4040
- repo: 'https://github.com/pycqa/isort'
41-
rev: 5.12.0
41+
rev: 5.13.2
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: 23.3.0
53+
rev: 24.8.0
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: 6.0.0
69+
rev: 7.1.1
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.3.0
81+
rev: v1.11.1
8282
hooks:
8383
- id: mypy
8484
args:

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
### v1.8.0
4+
5+
Updates dbt-sqlserver to support dbt 1.8.
6+
7+
Notable changes
8+
9+
- Adopts `dbt-common` and `dbt-adapters` as the upstream, in line with dbt projects.
10+
- Implements the majority of the tests from the `dbt-test-adapters` project to provide better coverage.
11+
- Implements better testing for `dbt-sqlserver` specific functions, including indexes.
12+
- Realigns to closer to the global project, overriding some fabric specific implementations
13+
14+
Update also fixes a number of regressions related to the fabric adapter. These include
15+
16+
- Proper ALTER syntax for column changes (in both )
17+
- https://github.com/dbt-msft/dbt-sqlserver/pull/504/files
18+
- Restoring cluster columntables post create on `tables`
19+
- https://github.com/dbt-msft/dbt-sqlserver/issues/473
20+
- Adds proper constraints to tables and columns
21+
- https://github.com/dbt-msft/dbt-sqlserver/pull/500
22+
23+
324
### v1.7.2
425

526
Huge thanks to GitHub users **@cody-scott** and **@prescode** for help with this long-awaited update to enable `dbt-core` 1.7.2 compatibility!

dbt/adapters/sqlserver/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from dbt.adapters.base import AdapterPlugin
22

3-
from dbt.adapters.sqlserver.sql_server_adapter import SQLServerAdapter
4-
from dbt.adapters.sqlserver.sql_server_column import SQLServerColumn
5-
from dbt.adapters.sqlserver.sql_server_configs import SQLServerConfigs
6-
from dbt.adapters.sqlserver.sql_server_connection_manager import SQLServerConnectionManager
7-
from dbt.adapters.sqlserver.sql_server_credentials import SQLServerCredentials
3+
from dbt.adapters.sqlserver.sqlserver_adapter import SQLServerAdapter
4+
from dbt.adapters.sqlserver.sqlserver_column import SQLServerColumn
5+
from dbt.adapters.sqlserver.sqlserver_configs import SQLServerConfigs
6+
from dbt.adapters.sqlserver.sqlserver_connections import SQLServerConnectionManager # noqa
7+
from dbt.adapters.sqlserver.sqlserver_credentials import SQLServerCredentials
88
from dbt.include import sqlserver
99

1010
Plugin = AdapterPlugin(

dbt/adapters/sqlserver/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = "1.7.4"
1+
version = "1.8.0"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from dbt.adapters.sqlserver.relation_configs.policies import (
2+
MAX_CHARACTERS_IN_IDENTIFIER,
3+
SQLServerIncludePolicy,
4+
SQLServerQuotePolicy,
5+
SQLServerRelationType,
6+
)
7+
8+
__all__ = [
9+
"MAX_CHARACTERS_IN_IDENTIFIER",
10+
"SQLServerIncludePolicy",
11+
"SQLServerQuotePolicy",
12+
"SQLServerRelationType",
13+
]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from dataclasses import dataclass
2+
3+
from dbt.adapters.contracts.relation import Policy
4+
from dbt_common.dataclass_schema import StrEnum
5+
6+
MAX_CHARACTERS_IN_IDENTIFIER = 127
7+
8+
9+
class SQLServerRelationType(StrEnum):
10+
Table = "table"
11+
View = "view"
12+
CTE = "cte"
13+
14+
15+
class SQLServerIncludePolicy(Policy):
16+
database: bool = True
17+
schema: bool = True
18+
identifier: bool = True
19+
20+
21+
@dataclass
22+
class SQLServerQuotePolicy(Policy):
23+
database: bool = True
24+
schema: bool = True
25+
identifier: bool = True

dbt/adapters/sqlserver/sql_server_adapter.py

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)