Skip to content

Commit 75a59a3

Browse files
committed
fix: address review feedback on identifier length validation
- Add @classmethod decorator and -> int return type to relation_max_name_length() - Broaden error message to not mention store_failures specifically; the validator fires on any oversized identifier (models, seeds, snapshots, etc.) - Remove test_relation_max_name_length test (failing and not required per review) - Move CHANGELOG entry from 1.11.7 to new 1.11.8 section https://claude.ai/code/session_017ZAXMwLSnqz4FqvTt5H7D1
1 parent a8b866b commit 75a59a3

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## dbt-databricks 1.11.8 (TBD)
2+
3+
### Fixes
4+
5+
- Validate relation identifier length at creation time and raise a clear error when it exceeds Databricks' 255-character limit ([#1309](https://github.com/databricks/dbt-databricks/issues/1309))
6+
17
## dbt-databricks 1.11.7 (Apr 17, 2026)
28

39
### Features
@@ -10,7 +16,6 @@
1016
- Fix `workflow_job` Python model submission method failing with dictionary attribute error ([#1360](https://github.com/databricks/dbt-databricks/issues/1360))
1117
- Fix `TestWorkflowJob` functional test that was unreachable on all profiles due to incorrect skip list, wrong model fixture, and invalid `max_retries` parameter ([#1360](https://github.com/databricks/dbt-databricks/issues/1360))
1218
- Fix column order mismatch in microbatch and replace_where incremental strategies by using INSERT BY NAME syntax ([#1338](https://github.com/databricks/dbt-databricks/issues/1338))
13-
- Validate relation identifier length at creation time and raise a clear error when it exceeds Databricks' 255-character limit, preventing confusing runtime failures when `store_failures: true` generates long table names ([#1309](https://github.com/databricks/dbt-databricks/issues/1309))
1419
- Fix `dbt run --empty` failing with inline `ref()` / `source()` aliases ([dbt-labs/dbt-adapters#660](https://github.com/dbt-labs/dbt-adapters/issues/660))
1520

1621
### Under the Hood

dbt/adapters/databricks/relation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,13 @@ def __post_init__(self) -> None:
9393
raise DbtRuntimeError(
9494
f"Relation name '{self.identifier}' is longer than "
9595
f"{self.relation_max_name_length()} characters. "
96-
"Use a shorter test name or configure a custom alias."
96+
"Databricks has a maximum identifier length of "
97+
f"{self.relation_max_name_length()} characters. "
98+
"Use a shorter name or configure a custom alias."
9799
)
98100

99-
def relation_max_name_length(self):
101+
@classmethod
102+
def relation_max_name_length(cls) -> int:
100103
return MAX_CHARACTERS_IN_IDENTIFIER
101104

102105
@classmethod

tests/unit/test_relation.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,6 @@ def test_render_constraints_for_create__with_constraints(
373373

374374

375375
class TestIdentifierLengthValidation:
376-
def test_relation_max_name_length(self):
377-
assert DatabricksRelation.relation_max_name_length() == MAX_CHARACTERS_IN_IDENTIFIER
378-
379376
def test_valid_identifier_length(self):
380377
identifier = "a" * MAX_CHARACTERS_IN_IDENTIFIER
381378
rel = DatabricksRelation.create(identifier=identifier, type="table")

0 commit comments

Comments
 (0)