Skip to content

Commit fa00a26

Browse files
authored
Merge branch 'main' into sd-db/spog-impl
2 parents 3e9ef55 + 2d36bee commit fa00a26

8 files changed

Lines changed: 69 additions & 25 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@
77

88
### Fixes
99

10+
- Ignore the server-set `delta.parquet.compression.codec` tblproperty when diffing relation configs, so streaming tables and materialized views are not flagged as changed after the backend started stamping it automatically ([#1489](https://github.com/databricks/dbt-databricks/pull/1489))
1011
- Fix missing f-string prefix in `JobRunsApi.submit` debug log ([#1471](https://github.com/databricks/dbt-databricks/pull/1471))
1112
- Fix capability-branching macros falling through to their legacy path at parse/compile time on SQL warehouses. The parse-time stub of `has_dbr_capability` now returns `True` on warehouse profiles for capabilities flagged `sql_warehouse_supported`, so macros select the modern branch during compilation instead of the legacy fallback. ([#1449](https://github.com/databricks/dbt-databricks/pull/1449) closes [#1331](https://github.com/databricks/dbt-databricks/issues/1331))
1213
- Fix snapshots not applying `databricks_tags` on columns ([#1442](https://github.com/databricks/dbt-databricks/pull/1442) closes [#1441](https://github.com/databricks/dbt-databricks/issues/1441))
1314
- `EXTRACT_CLUSTER_ID_FROM_HTTP_PATH_REGEX` now stops the capture at `?` / `&`, so any trailing query string on `http_path` no longer corrupts the extracted cluster id. Latent issue on legacy hosts; the fix unblocks SPOG cluster paths.
1415

1516
### Under the Hood
1617

18+
- Raise the `dbt-tests-adapter` test-dependency floor to `>=1.20.0` to pick up its `persist_docs` fixture typo fix (test-only, no runtime impact) ([#1490](https://github.com/databricks/dbt-databricks/pull/1490))
1719
- Defer SDK `Config` construction to connection-open time so offline paths (`dbt parse`/`list`/`compile`) don't trigger the host-metadata probe introduced in `databricks-sdk>=0.103`; as a side effect, auth errors now surface at first connection rather than during profile parsing. ([#1474](https://github.com/databricks/dbt-databricks/pull/1474))
1820
- Bump ceilings on `databricks-sdk` (now `<0.105.0`) and `databricks-sql-connector[pyarrow]` (now `<4.3.0`) to admit newer releases; floors unchanged. ([#1474](https://github.com/databricks/dbt-databricks/pull/1474))
21+
- Stabilize the `TestChangingSchema*` Python-model functional tests under min-deps (dbt-core 1.11.2), where a sibling class's source schema.yml could leak into their parse and fail with `EnvVarMissingError`. ([#1488](https://github.com/databricks/dbt-databricks/pull/1488))
1922

2023
## dbt-databricks 1.12.0 (May 18, 2026)
2124

dbt/adapters/databricks/relation_configs/tblproperties.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class TblPropertiesConfig(DatabricksComponentConfig):
4646
"spark.sql.internal.pipelines.parentTableId",
4747
"delta.enableDeletionVectors",
4848
"delta.feature.deletionVectors",
49+
"delta.parquet.compression.codec",
4950
]
5051

5152
def __eq__(self, __value: Any) -> bool:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ include = ["/dbt"]
4949

5050
[dependency-groups]
5151
test = [
52-
"dbt-tests-adapter>=1.19.0",
52+
"dbt-tests-adapter>=1.20.0",
5353
"pytest>=8.3.5",
5454
"pytest-xdist>=3.6.1",
5555
"pytest-rerunfailures>=14.0",

requirements.lowest-direct.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,13 +441,13 @@ dbt-common==1.37.2 \
441441
# dbt-adapters
442442
# dbt-core
443443
# dbt-spark
444+
# dbt-tests-adapter
444445
dbt-core==1.11.2 \
445446
--hash=sha256:3306fee149b9f4e648071f2c9a46c0551100e1c829f13ad7ce026eb7226ad454 \
446447
--hash=sha256:ac332fd61a4494494f48e1bbdc0696e309e79036b94eb0a929233bb71f4b3898
447448
# via
448449
# dbt-databricks (pyproject.toml)
449450
# dbt-spark
450-
# dbt-tests-adapter
451451
dbt-extractor==0.6.0 \
452452
--hash=sha256:05bcfab7ebd70296ceb31742e8333ba66a2c939de44e61a7088bebafa939aaf6 \
453453
--hash=sha256:080fd1edf123926ed97929c65a75874d0fea687ccd5d3ebbc9e81b339f099604 \
@@ -481,9 +481,9 @@ dbt-spark==1.10.0 \
481481
--hash=sha256:5d3755d832476ad5d4e3c2fe55247fa39763e990e186673fd88da7be989f0048 \
482482
--hash=sha256:95f4af4b5647553115eb6ca02539a3a1ad50b34bf2c6f3a766371f7de164578c
483483
# via dbt-databricks (pyproject.toml)
484-
dbt-tests-adapter==1.19.0 \
485-
--hash=sha256:25ccdefbf31164d2af76745edc245385e4bc7081d23836c5986bdd91e773deb6 \
486-
--hash=sha256:5cbd4b6acff4534adc38cfd61d1892c3bc259378657904ce42773588c3be8e34
484+
dbt-tests-adapter==1.20.0 \
485+
--hash=sha256:333d0d08c1690278a8cf681989f6359a7a8a5b3da464f14430c3ea3ea32fa5ff \
486+
--hash=sha256:91562371852790a647c59270136a4461bfda7e7484f349fcd3473f0a1d6059c6
487487
# via dbt-databricks (pyproject.toml:test)
488488
deepdiff==8.6.2 \
489489
--hash=sha256:186dcbd181e4d76cef11ab05f802d0056c5d6083c5a6748c1473e9d7481e183e \

tests/functional/adapter/persist_docs/test_persist_docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def models(self):
169169

170170
@pytest.fixture(scope="class")
171171
def properties(self):
172-
return {"schema.yml": fixtures._PROPERITES__SCHEMA_MISSING_COL}
172+
return {"schema.yml": fixtures._PROPERTIES__SCHEMA_MISSING_COL}
173173

174174
@pytest.fixture(scope="class")
175175
def table_relation(self, project):

tests/functional/adapter/python_model/test_python_model.py

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import os
23

34
import pytest
@@ -29,6 +30,31 @@ def verify_temp_table_cleaned(project, suffix):
2930
assert len(tmp_tables) == 0
3031

3132

33+
class SchemaNameVarMixin:
34+
"""Make the schema-change tests resilient to dbt-core test-isolation leakage.
35+
36+
These classes don't inherit ``BasePythonModelTests`` and run plain ``dbt run``. On
37+
dbt-core 1.11.2 a sibling class's ``test_source`` schema.yml -- whose ``schema``
38+
renders ``var(env_var('DBT_TEST_SCHEMA_NAME_VARIABLE'))`` -- can bleed into these
39+
classes' parse when they run after one in the same xdist worker (``--dist=loadfile``),
40+
failing with ``EnvVarMissingError``. Rendering that source needs both the env var
41+
(read from the invocation context) and the ``test_run_schema`` var. Schema-yaml
42+
rendering resolves ``var()`` from CLI vars only, so the var must be passed via
43+
``--vars`` -- exactly as dbt-core's ``BasePythonModelTests`` does -- not via
44+
project-level ``vars``.
45+
"""
46+
47+
@pytest.fixture(scope="class", autouse=True)
48+
def schema_name_env_var(self):
49+
os.environ["DBT_TEST_SCHEMA_NAME_VARIABLE"] = "test_run_schema"
50+
yield
51+
os.environ.pop("DBT_TEST_SCHEMA_NAME_VARIABLE", None)
52+
53+
@staticmethod
54+
def schema_name_vars(project):
55+
return ["--vars", json.dumps({"test_run_schema": project.test_schema})]
56+
57+
3258
@pytest.mark.python
3359
@pytest.mark.skip_profile("databricks_cluster")
3460
class TestPythonModel(BasePythonModelTests):
@@ -84,7 +110,7 @@ def project_config_update(self):
84110

85111
@pytest.mark.python
86112
@pytest.mark.skip_profile("databricks_cluster")
87-
class TestChangingSchema:
113+
class TestChangingSchema(SchemaNameVarMixin):
88114
"""Test Python model schema changes using serverless compute."""
89115

90116
@pytest.fixture(scope="class")
@@ -96,13 +122,14 @@ def project_config_update(self):
96122
return {"models": {"+create_notebook": "true"}}
97123

98124
def test_changing_schema_with_log_validation(self, project, logs_dir):
99-
util.run_dbt(["run"])
125+
schema_vars = self.schema_name_vars(project)
126+
util.run_dbt(["run", *schema_vars])
100127
util.write_file(
101128
override_fixtures.simple_python_model_v2,
102129
project.project_root + "/models",
103130
"simple_python_model.py",
104131
)
105-
util.run_dbt(["run"])
132+
util.run_dbt(["run", *schema_vars])
106133
log_file = os.path.join(logs_dir, "dbt.log")
107134
with open(log_file) as f:
108135
log = f.read()
@@ -113,7 +140,7 @@ def test_changing_schema_with_log_validation(self, project, logs_dir):
113140

114141
@pytest.mark.python
115142
@pytest.mark.skip_profile("databricks_cluster")
116-
class TestChangingSchemaIncremental:
143+
class TestChangingSchemaIncremental(SchemaNameVarMixin):
117144
"""Test Python incremental schema changes using serverless compute."""
118145

119146
@pytest.fixture(scope="class")
@@ -129,9 +156,10 @@ def project_config_update(self):
129156
return {"models": {"+create_notebook": "true"}}
130157

131158
def test_changing_schema_via_incremental(self, project):
132-
util.run_dbt(["seed"])
133-
util.run_dbt(["run"])
134-
util.run_dbt(["run"])
159+
schema_vars = self.schema_name_vars(project)
160+
util.run_dbt(["seed", *schema_vars])
161+
util.run_dbt(["run", *schema_vars])
162+
util.run_dbt(["run", *schema_vars])
135163

136164
util.check_relations_equal(project.adapter, ["incremental_model", "expected_incremental"])
137165

@@ -412,7 +440,7 @@ def test_python_model_with_access_control_list(self, project):
412440

413441

414442
@pytest.mark.skip_profile("databricks_cluster")
415-
class TestChangingSchemaV2(MaterializationV2Mixin):
443+
class TestChangingSchemaV2(SchemaNameVarMixin, MaterializationV2Mixin):
416444
"""Test Python model schema changes with V2 materialization using serverless compute."""
417445

418446
@pytest.fixture(scope="class")
@@ -424,19 +452,20 @@ def project_config_update(self):
424452
return {"models": {"+create_notebook": "true"}}
425453

426454
def test_changing_unique_tmp_table_suffix(self, project):
427-
util.run_dbt(["run"])
455+
schema_vars = self.schema_name_vars(project)
456+
util.run_dbt(["run", *schema_vars])
428457
util.write_file(
429458
override_fixtures.simple_python_model_v2,
430459
project.project_root + "/models",
431460
"simple_python_model.py",
432461
)
433-
util.run_dbt(["run"])
462+
util.run_dbt(["run", *schema_vars])
434463
verify_temp_tables_cleaned(project)
435464

436465

437466
@pytest.mark.python
438467
@pytest.mark.skip_profile("databricks_cluster")
439-
class TestChangingSchemaIncrementalV2(MaterializationV2Mixin):
468+
class TestChangingSchemaIncrementalV2(SchemaNameVarMixin, MaterializationV2Mixin):
440469
"""Test Python incremental schema changes with V2 materialization using serverless compute."""
441470

442471
@pytest.fixture(scope="class")
@@ -448,13 +477,14 @@ def project_config_update(self):
448477
return {"models": {"+create_notebook": "true"}}
449478

450479
def test_changing_unique_tmp_table_suffix(self, project):
451-
util.run_dbt(["run"])
480+
schema_vars = self.schema_name_vars(project)
481+
util.run_dbt(["run", *schema_vars])
452482
util.write_file(
453483
override_fixtures.simple_incremental_python_model_v2,
454484
project.project_root + "/models",
455485
"incremental_model.py",
456486
)
457-
util.run_dbt(["run"])
487+
util.run_dbt(["run", *schema_vars])
458488
verify_temp_tables_cleaned(project)
459489

460490

tests/unit/relation_configs/test_tblproperties.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ def test_from_results__multiple(self):
3030
spec = TblPropertiesProcessor.from_relation_results(results)
3131
assert spec == TblPropertiesConfig(tblproperties={"prop": "1", "other": "other"})
3232

33+
def test_from_results__drops_ignored_properties(self):
34+
# Properties set by Databricks (e.g. the server-default parquet compression codec)
35+
# must be dropped so they don't show up as spurious configuration changes.
36+
results = {
37+
"show_tblproperties": fixtures.gen_tblproperties(
38+
[["prop", "1"], ["delta.parquet.compression.codec", "zstd"]]
39+
)
40+
}
41+
spec = TblPropertiesProcessor.from_relation_results(results)
42+
assert spec == TblPropertiesConfig(tblproperties={"prop": "1"})
43+
3344
def test_from_model_node__without_tblproperties(self):
3445
model = Mock()
3546
model.config.extra = {}

uv.lock

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)