fix: enforce 255-character identifier length limit for Databricks relations#1391
Open
psaikaushik wants to merge 1 commit intodatabricks:mainfrom
Open
fix: enforce 255-character identifier length limit for Databricks relations#1391psaikaushik wants to merge 1 commit intodatabricks:mainfrom
psaikaushik wants to merge 1 commit intodatabricks:mainfrom
Conversation
…ations Add relation_max_name_length() returning 255 and a __post_init__ validation to DatabricksRelation, following the same pattern used by the Postgres adapter. This catches overly-long table names (commonly generated by store_failures for tests with verbose names) at relation creation time with a clear error message instead of a cryptic runtime DatabricksExecutionError from the SQL engine. Closes databricks#1309
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enforces the 255-character identifier length limit for Databricks relations at relation creation time, preventing a cryptic runtime
DatabricksExecutionErrorwhenstore_failuresgenerates overly-long table names.Closes #1309
Problem
When
store_failures: trueis enabled, dbt generates table names by concatenating the test name, model name, and arguments. For deep schema tests with verbose names, this can exceed Databricks' 255-character limit for table names, causing:This error is unhelpful — it doesn't explain what the 255-character limit is, which test/model caused it, or how to fix it.
Fix
Added
relation_max_name_length()and__post_init__validation toDatabricksRelation, following the exact same pattern used by the Postgres adapter:Before:
After:
Checklist