From c7d96daee7001761d126c4f73f5ee94deaf8b705 Mon Sep 17 00:00:00 2001 From: Jay Jiang <48189996+crankswagon@users.noreply.github.com> Date: Thu, 15 Sep 2022 08:58:20 +1000 Subject: [PATCH] expand `parameter` documentation for `databricks_sql_query` resource Revert "expand `parameter` documentation for `databricks_sql_query` resource" This reverts commit 3061cfe0532142ef49f0a4980783effad86c5d2f. expand docs --- docs/resources/sql_query.md | 39 +++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/docs/resources/sql_query.md b/docs/resources/sql_query.md index 25b3142850..32a043e52c 100644 --- a/docs/resources/sql_query.md +++ b/docs/resources/sql_query.md @@ -15,8 +15,14 @@ A query may have one or more [visualizations](sql_visualization.md). resource "databricks_sql_query" "q1" { data_source_id = databricks_sql_endpoint.example.data_source_id name = "My Query Name" - query = "SELECT {{ p1 }} AS p1, 2 as p2" - run_as_role = "viewer" + query = < date '{{ p3 }}' + EOT + + run_as_role = "viewer" schedule { continuous { @@ -32,6 +38,31 @@ resource "databricks_sql_query" "q1" { } } + parameter { + name = "p2" + title = "Title for p2" + enum { + options = ["default", "foo", "bar"] + value = "default" + // passes to sql query as string `"foo", "bar"` if foo and bar are both selected in the front end + multiple { + prefix = "\"" + suffix = "\"" + separator = "," + } + + } + } + + parameter { + name = "p3" + title = "Title for p3" + date { + value = "2022-01-01" + } + } + + tags = [ "t1", "t2", @@ -66,6 +97,10 @@ You can import a `databricks_sql_query` resource with ID like the following: $ terraform import databricks_sql_query.this ``` +## Troubleshooting + +In case you see `Error: cannot create sql query: Internal Server Error` during `terraform apply`; double check that you are using the correct [`data_source_id`](sql_endpoint.md) + ## Related Resources The following resources are often used in the same context: