Skip to content

Commit a4c9acc

Browse files
p-venclovasnkvuongtanmay-dbalexott
authored
[Fix] Tables with struct subcolumns which have dot in their name are redeployed on databricks_sql_table resource #3866 (#4001)
## Changes <!-- Summary of your changes that are easy to understand --> Backticks are removed from the column type in order for struct subfield names to be compatible with the subfield names deployed. These subfields names are part of the column type. Example struct<\`x.z\`:string> == struct\<x.z:string> ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [x] `make test` run locally - [x] relevant acceptance tests are passing - [x] using Go SDK tested using internal integration tests where tables were created and terraform plans were reviewed to have no changes. --------- Co-authored-by: Vuong <[email protected]> Co-authored-by: vuong-nguyen <[email protected]> Co-authored-by: Tanmay Rustagi <[email protected]> Co-authored-by: Alex Ott <[email protected]>
1 parent 2bebaa1 commit a4c9acc

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
### New Features and Improvements
1010

11+
* Don't redeploy `databricks_sql_table` for tables with struct subcolumns ([#4001](https://github.com/databricks/terraform-provider-databricks/pull/4001)).
1112
* Added ability to add `comment` when defining a new `databricks_share` ([#4802](https://github.com/databricks/terraform-provider-databricks/pull/4802))
1213
* Added output attribute `endpoint_url` in `databricks_model_serving` ([#4877](https://github.com/databricks/terraform-provider-databricks/pull/4877)).
1314
* Deprecate `egg` library type in `databricks_cluster`, `databricks_job`, and `databricks_library` ([#4881](https://github.com/databricks/terraform-provider-databricks/pull/4881)).

catalog/resource_sql_table.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,10 @@ var columnTypeAliases = map[string]string{
562562
}
563563

564564
func getColumnType(columnType string) string {
565-
caseInsensitiveColumnType := strings.ToLower(columnType)
565+
// client side normalization is necessary to match normalization
566+
// that is happening on the backend side
567+
columnTypeNoBackticks := strings.ReplaceAll(columnType, "`", "")
568+
caseInsensitiveColumnType := strings.ToLower(columnTypeNoBackticks)
566569
if alias, ok := columnTypeAliases[caseInsensitiveColumnType]; ok {
567570
return alias
568571
}

0 commit comments

Comments
 (0)