terraform-provider-databricks icon indicating copy to clipboard operation
terraform-provider-databricks copied to clipboard

[ISSUE] Issue with `databricks_sql_table` resource - column names are not escaped

Open JoshCadney opened this issue 1 year ago • 3 comments

Configuration

resource "databricks_sql_table" "tbl_test" {
  warehouse_id       = var.sql_warehouse_id
  name               = "tbl_test"
  catalog_name       = "${var.databricks_catalog_prefix}main"
  schema_name        = "_raw"
  table_type         = "MANAGED"
  data_source_format = "DELTA"

  column {
    name     = "Test.Name"
    type     = "string"
  }
}

Expected Behavior

A table would be created with a column called Test.Name

Actual Behavior

An error occurred executing terraform apply.

Output from terraform:

│ Error: cannot create sql table: statement failed to execute: FAILED
│
│   with module.databricks_tbl.databricks_sql_table.tbl_test,
│   on ..\modules\databricks-tbl\test.tf line 1, in resource "databricks_sql_table" "tbl_test":
│    1: resource "databricks_sql_table" "tbl_test" {

Output from query history in Databricks:

[PARSE_SYNTAX_ERROR] Syntax error at or near '.'.(line 1, pos 54)

== SQL ==
CREATE TABLE `prefix_main`.`_raw`.`tbl_test` (Test.Name string)
------------------------------------------------------^^^
USING DELTA;

Steps to Reproduce

  1. terraform apply

Terraform and provider versions

Terraform v1.7.4
on windows_amd64
+ provider registry.terraform.io/azure/azapi v1.10.0
+ provider registry.terraform.io/databricks/databricks v1.30.0
+ provider registry.terraform.io/hashicorp/azurerm v3.66.0
+ provider registry.terraform.io/hashicorp/null v3.2.2

Is it a regression?

No

JoshCadney avatar Feb 26 '24 11:02 JoshCadney

@JoshCadney this should have been fixed in the latest release - could you confirm that it is working now?

nkvuong avatar Apr 05 '24 11:04 nkvuong

@nkvuong Unfortunately, I'm now working on a different project, and I no longer have access to a databricks account to test on :-( However, if you've tested with the minimal example I've given above, then I'm sure it will be working and I'm happy to close the issue.

JoshCadney avatar Apr 05 '24 11:04 JoshCadney

it's already working for me, I think this issue can be closed.

ivandad1 avatar Aug 05 '24 13:08 ivandad1