How to execute SQL statement using terraform
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 10:56 AM
Is there a way to execute SQL statements using Terraform
I can see it can be possible using API as bellow,
https://docs.databricks.com/api/workspace/statementexecution/executestatement
but I want to know is a strength way to run like bellow code
provider "databricks" {
host = var.databricks_host
token = var.databricks_token
}
resource "databricks_sql_query" "example" {
name = "example-query"
data_source_id = var.data_source_id
query = "SELECT * FROM your_table"
}
resource "local_file" "query_result" {
content = jsonencode(databricks_sql_query.example.output)
filename = "${path.module}/query_result.json"
}