Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE] Issue with databricks_table resource #1624

Closed
niraj8241 opened this issue Sep 21, 2022 · 2 comments
Closed

[ISSUE] Issue with databricks_table resource #1624

niraj8241 opened this issue Sep 21, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@niraj8241
Copy link

Configuration

resource "databricks_table" "table" {
  provider = databricks.workspace
  name                    = "myview"
  catalog_name            = "team_platform"
  schema_name             = "test"
  table_type              = "VIEW"
  view_definition         = "create view team_platform.test.myview as select * from test.mytable"
  data_source_format      = "DELTA"
  comment                 = "Managed by Terraform"
  column {
    name      = "id"
    position  = 0
    type_name = "INT"
    type_text = "int"
    type_json = "{\"name\":\"id\",\"type\":\"integer\",\"nullable\":true,\"metadata\":{}}"
  }
}

Expected Behavior

<I tried to create a view using the documentation. It seems like there is an issue with the way we are creating views. Using the above simple TF code. I get an error trying to create a simple view.

Actual Behavior

<

  • When column block is missing: Terraform complains that there isn't any column block and atleast 1 is requried. As per the databricks documentation i do not see any requirement as such to specify columns when creating views.

  • When data_source_format is missing: I get an error "The argument "data_source_format" is required, but no definition was found". As per databricks documentation, this isn't required as well.

Steps to Reproduce

<

  1. Create a databricks view as "select * from tablename"

Terraform and provider versions

<
Terraform v1.1.9
on linux_amd64

  • provider registry.terraform.io/databricks/databricks v1.3.0
  • provider registry.terraform.io/hashicorp/aws v3.75.2
  • provider registry.terraform.io/hashicorp/template v2.2.0
  • provider registry.terraform.io/hashicorp/time v0.8.0

Your version of Terraform is out of date! The latest version
is 1.2.9. You can update by downloading from https://www.terraform.io/downloads.html

@nfx nfx added the bug Something isn't working label Sep 23, 2022
@nkvuong
Copy link
Contributor

nkvuong commented Sep 23, 2022

@niraj8241 so there are quite a few gaps/edge cases with the tables API, hence customers should not use the API or Terraform to create/manage Unity Catalog tables & views at the moment.

To your observations:

  • column block is required by the API. When creating a view/table on a cluster, the cluster actually generates the relevant column block and send it to the API (hence the above statement)
  • data_source_format can be skipped when creating a view, but this was missing from the provider logic. We can consider fixing this, but it will be of lower priority.

@niraj8241
Copy link
Author

@nkvuong Thanks for the info on the columns. I will hold on with table creation through terraform.

@nfx nfx closed this as completed Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants