From d554f8191282d569613dba3f7a0d0131eccb2abe Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Wed, 13 Nov 2024 14:57:34 -0800 Subject: [PATCH 01/18] Update resource_quality_monitor.go --- catalog/resource_quality_monitor.go | 1 - 1 file changed, 1 deletion(-) diff --git a/catalog/resource_quality_monitor.go b/catalog/resource_quality_monitor.go index 1d2beffc4e..9e9169fd4e 100644 --- a/catalog/resource_quality_monitor.go +++ b/catalog/resource_quality_monitor.go @@ -53,7 +53,6 @@ func ResourceQualityMonitor() common.Resource { common.CustomizeSchemaPath(m, "profile_metrics_table_name").SetReadOnly() common.CustomizeSchemaPath(m, "status").SetReadOnly() common.CustomizeSchemaPath(m, "dashboard_id").SetReadOnly() - common.CustomizeSchemaPath(m, "schedule", "pause_status").SetReadOnly() return m }, ) From 54d140882a00735531661e69a43f73365e2b9e2c Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:07:39 -0800 Subject: [PATCH 02/18] Update resource_quality_monitor.go --- catalog/resource_quality_monitor.go | 1 + 1 file changed, 1 insertion(+) diff --git a/catalog/resource_quality_monitor.go b/catalog/resource_quality_monitor.go index 9e9169fd4e..cabc13b542 100644 --- a/catalog/resource_quality_monitor.go +++ b/catalog/resource_quality_monitor.go @@ -53,6 +53,7 @@ func ResourceQualityMonitor() common.Resource { common.CustomizeSchemaPath(m, "profile_metrics_table_name").SetReadOnly() common.CustomizeSchemaPath(m, "status").SetReadOnly() common.CustomizeSchemaPath(m, "dashboard_id").SetReadOnly() + return m }, ) From d9bb13bd338747427615313e6f795ef3526787bc Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:08:16 -0800 Subject: [PATCH 03/18] [ML-47387] fix UpdateMonitor failure --- catalog/resource_quality_monitor.go | 1 - 1 file changed, 1 deletion(-) diff --git a/catalog/resource_quality_monitor.go b/catalog/resource_quality_monitor.go index cabc13b542..9e9169fd4e 100644 --- a/catalog/resource_quality_monitor.go +++ b/catalog/resource_quality_monitor.go @@ -53,7 +53,6 @@ func ResourceQualityMonitor() common.Resource { common.CustomizeSchemaPath(m, "profile_metrics_table_name").SetReadOnly() common.CustomizeSchemaPath(m, "status").SetReadOnly() common.CustomizeSchemaPath(m, "dashboard_id").SetReadOnly() - return m }, ) From f5f79a7cbd4728631500ec6588b4c074781f5bd7 Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Wed, 13 Nov 2024 16:34:49 -0800 Subject: [PATCH 04/18] Update resource_quality_monitor.go --- .../resources/qualitymonitor/resource_quality_monitor.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/providers/pluginfw/resources/qualitymonitor/resource_quality_monitor.go b/internal/providers/pluginfw/resources/qualitymonitor/resource_quality_monitor.go index 7a0445ddbb..0a049644e7 100644 --- a/internal/providers/pluginfw/resources/qualitymonitor/resource_quality_monitor.go +++ b/internal/providers/pluginfw/resources/qualitymonitor/resource_quality_monitor.go @@ -78,7 +78,6 @@ func (r *QualityMonitorResource) Schema(ctx context.Context, req resource.Schema c.SetReadOnly("profile_metrics_table_name") c.SetReadOnly("status") c.SetReadOnly("dashboard_id") - c.SetReadOnly("schedule", "pause_status") return c }) resp.Schema = schema.Schema{ From be8b79cb8b4f922378d0fae0dc756323d4d75482 Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Fri, 15 Nov 2024 10:36:25 -0800 Subject: [PATCH 05/18] Update resource_quality_monitor.go --- catalog/resource_quality_monitor.go | 1 + 1 file changed, 1 insertion(+) diff --git a/catalog/resource_quality_monitor.go b/catalog/resource_quality_monitor.go index 9e9169fd4e..1d2beffc4e 100644 --- a/catalog/resource_quality_monitor.go +++ b/catalog/resource_quality_monitor.go @@ -53,6 +53,7 @@ func ResourceQualityMonitor() common.Resource { common.CustomizeSchemaPath(m, "profile_metrics_table_name").SetReadOnly() common.CustomizeSchemaPath(m, "status").SetReadOnly() common.CustomizeSchemaPath(m, "dashboard_id").SetReadOnly() + common.CustomizeSchemaPath(m, "schedule", "pause_status").SetReadOnly() return m }, ) From 54aa6e9b7bbbefb01582b2f5cb644209e86f7817 Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Fri, 15 Nov 2024 10:37:03 -0800 Subject: [PATCH 06/18] Update resource_quality_monitor.go --- .../resources/qualitymonitor/resource_quality_monitor.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/providers/pluginfw/resources/qualitymonitor/resource_quality_monitor.go b/internal/providers/pluginfw/resources/qualitymonitor/resource_quality_monitor.go index 0a049644e7..7a0445ddbb 100644 --- a/internal/providers/pluginfw/resources/qualitymonitor/resource_quality_monitor.go +++ b/internal/providers/pluginfw/resources/qualitymonitor/resource_quality_monitor.go @@ -78,6 +78,7 @@ func (r *QualityMonitorResource) Schema(ctx context.Context, req resource.Schema c.SetReadOnly("profile_metrics_table_name") c.SetReadOnly("status") c.SetReadOnly("dashboard_id") + c.SetReadOnly("schedule", "pause_status") return c }) resp.Schema = schema.Schema{ From 36145e0564447da873d866eb650811f17bbb196d Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Fri, 15 Nov 2024 10:43:00 -0800 Subject: [PATCH 07/18] set pause_status to empty in resource_quality_monitor.go --- catalog/resource_quality_monitor.go | 1 + 1 file changed, 1 insertion(+) diff --git a/catalog/resource_quality_monitor.go b/catalog/resource_quality_monitor.go index 1d2beffc4e..8d2183b628 100644 --- a/catalog/resource_quality_monitor.go +++ b/catalog/resource_quality_monitor.go @@ -100,6 +100,7 @@ func ResourceQualityMonitor() common.Resource { var update catalog.UpdateMonitor common.DataToStructPointer(d, monitorSchema, &update) update.TableName = d.Get("table_name").(string) + update.PauseStatus = "" _, err = w.QualityMonitors.Update(ctx, update) if err != nil { return err From 45d1effe26f53173b134a9d6b07abb34dbec834c Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Fri, 15 Nov 2024 10:52:54 -0800 Subject: [PATCH 08/18] Update resource_quality_monitor.go --- catalog/resource_quality_monitor.go | 1 - 1 file changed, 1 deletion(-) diff --git a/catalog/resource_quality_monitor.go b/catalog/resource_quality_monitor.go index 8d2183b628..1d2beffc4e 100644 --- a/catalog/resource_quality_monitor.go +++ b/catalog/resource_quality_monitor.go @@ -100,7 +100,6 @@ func ResourceQualityMonitor() common.Resource { var update catalog.UpdateMonitor common.DataToStructPointer(d, monitorSchema, &update) update.TableName = d.Get("table_name").(string) - update.PauseStatus = "" _, err = w.QualityMonitors.Update(ctx, update) if err != nil { return err From d22a018138c2e542e337547eb78d6ff7f34ecc19 Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Fri, 15 Nov 2024 10:59:53 -0800 Subject: [PATCH 09/18] Update resource_quality_monitor.go --- .../pluginfw/products/qualitymonitor/resource_quality_monitor.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go b/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go index 7a0445ddbb..5f480c21f4 100644 --- a/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go +++ b/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go @@ -195,6 +195,7 @@ func (r *QualityMonitorResource) Update(ctx context.Context, req resource.Update if resp.Diagnostics.HasError() { return } + updateMonitorGoSDK.PauseStatus = "" monitor, err := w.QualityMonitors.Update(ctx, updateMonitorGoSDK) if err != nil { resp.Diagnostics.AddError("failed to update monitor", err.Error()) From d76766523374936de7491a12f44dabbcdd16044e Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:01:38 -0800 Subject: [PATCH 10/18] Update resource_quality_monitor.go --- catalog/resource_quality_monitor.go | 1 + 1 file changed, 1 insertion(+) diff --git a/catalog/resource_quality_monitor.go b/catalog/resource_quality_monitor.go index 1d2beffc4e..153f55ef2b 100644 --- a/catalog/resource_quality_monitor.go +++ b/catalog/resource_quality_monitor.go @@ -100,6 +100,7 @@ func ResourceQualityMonitor() common.Resource { var update catalog.UpdateMonitor common.DataToStructPointer(d, monitorSchema, &update) update.TableName = d.Get("table_name").(string) + updateMonitorGoSDK.PauseStatus = "" _, err = w.QualityMonitors.Update(ctx, update) if err != nil { return err From 58dbeff1a9dab06c4f5194fa95cbc6c4e1195e20 Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:01:55 -0800 Subject: [PATCH 11/18] Update resource_quality_monitor.go --- catalog/resource_quality_monitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/resource_quality_monitor.go b/catalog/resource_quality_monitor.go index 153f55ef2b..8d2183b628 100644 --- a/catalog/resource_quality_monitor.go +++ b/catalog/resource_quality_monitor.go @@ -100,7 +100,7 @@ func ResourceQualityMonitor() common.Resource { var update catalog.UpdateMonitor common.DataToStructPointer(d, monitorSchema, &update) update.TableName = d.Get("table_name").(string) - updateMonitorGoSDK.PauseStatus = "" + update.PauseStatus = "" _, err = w.QualityMonitors.Update(ctx, update) if err != nil { return err From 13b6fd93e6088bdbcb16bc8977b9bf610c0f9980 Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:06:38 -0800 Subject: [PATCH 12/18] Update resource_quality_monitor.go --- catalog/resource_quality_monitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/resource_quality_monitor.go b/catalog/resource_quality_monitor.go index 8d2183b628..97581170ad 100644 --- a/catalog/resource_quality_monitor.go +++ b/catalog/resource_quality_monitor.go @@ -100,7 +100,7 @@ func ResourceQualityMonitor() common.Resource { var update catalog.UpdateMonitor common.DataToStructPointer(d, monitorSchema, &update) update.TableName = d.Get("table_name").(string) - update.PauseStatus = "" + update.Schedule.PauseStatus = "" _, err = w.QualityMonitors.Update(ctx, update) if err != nil { return err From 839c0eeff62011ebabc138b458dc6028ed12ea63 Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:07:04 -0800 Subject: [PATCH 13/18] Update resource_quality_monitor.go --- .../products/qualitymonitor/resource_quality_monitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go b/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go index 5f480c21f4..d39e784157 100644 --- a/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go +++ b/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go @@ -196,7 +196,7 @@ func (r *QualityMonitorResource) Update(ctx context.Context, req resource.Update return } updateMonitorGoSDK.PauseStatus = "" - monitor, err := w.QualityMonitors.Update(ctx, updateMonitorGoSDK) + monitor, err := w.QualityMonitors.Schedule.Update(ctx, updateMonitorGoSDK) if err != nil { resp.Diagnostics.AddError("failed to update monitor", err.Error()) return From 2fe48fe7dd3e1be0849adcb0c4bbe5437e7490b3 Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:08:35 -0800 Subject: [PATCH 14/18] Update resource_quality_monitor.go --- .../products/qualitymonitor/resource_quality_monitor.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go b/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go index d39e784157..8f6551922c 100644 --- a/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go +++ b/internal/providers/pluginfw/products/qualitymonitor/resource_quality_monitor.go @@ -195,8 +195,10 @@ func (r *QualityMonitorResource) Update(ctx context.Context, req resource.Update if resp.Diagnostics.HasError() { return } - updateMonitorGoSDK.PauseStatus = "" - monitor, err := w.QualityMonitors.Schedule.Update(ctx, updateMonitorGoSDK) + if updateMonitorGoSDK.Schedule != nil { + updateMonitorGoSDK.Schedule.PauseStatus = "" + } + monitor, err := w.QualityMonitors.Update(ctx, updateMonitorGoSDK) if err != nil { resp.Diagnostics.AddError("failed to update monitor", err.Error()) return From 2e18190c558a1a7610ec23fcef7efd4218743409 Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:09:03 -0800 Subject: [PATCH 15/18] Update resource_quality_monitor.go --- catalog/resource_quality_monitor.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/catalog/resource_quality_monitor.go b/catalog/resource_quality_monitor.go index 97581170ad..cc8abd568e 100644 --- a/catalog/resource_quality_monitor.go +++ b/catalog/resource_quality_monitor.go @@ -100,7 +100,9 @@ func ResourceQualityMonitor() common.Resource { var update catalog.UpdateMonitor common.DataToStructPointer(d, monitorSchema, &update) update.TableName = d.Get("table_name").(string) - update.Schedule.PauseStatus = "" + if (update.Schedule != nil){ + update.Schedule.PauseStatus = "" + } _, err = w.QualityMonitors.Update(ctx, update) if err != nil { return err From fb9d580958ef20e382a6ed95eab14227ca3e6fd4 Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:09:25 -0800 Subject: [PATCH 16/18] Update resource_quality_monitor.go --- catalog/resource_quality_monitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/resource_quality_monitor.go b/catalog/resource_quality_monitor.go index cc8abd568e..12a83c0690 100644 --- a/catalog/resource_quality_monitor.go +++ b/catalog/resource_quality_monitor.go @@ -100,7 +100,7 @@ func ResourceQualityMonitor() common.Resource { var update catalog.UpdateMonitor common.DataToStructPointer(d, monitorSchema, &update) update.TableName = d.Get("table_name").(string) - if (update.Schedule != nil){ + if update.Schedule != nil{ update.Schedule.PauseStatus = "" } _, err = w.QualityMonitors.Update(ctx, update) From cd0ae4c96f092bfad3365b8f925fcfb56fbe1c2f Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:09:51 -0800 Subject: [PATCH 17/18] Update resource_quality_monitor.go --- catalog/resource_quality_monitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/resource_quality_monitor.go b/catalog/resource_quality_monitor.go index 12a83c0690..c385a83a9e 100644 --- a/catalog/resource_quality_monitor.go +++ b/catalog/resource_quality_monitor.go @@ -100,7 +100,7 @@ func ResourceQualityMonitor() common.Resource { var update catalog.UpdateMonitor common.DataToStructPointer(d, monitorSchema, &update) update.TableName = d.Get("table_name").(string) - if update.Schedule != nil{ + if update.Schedule != nil { update.Schedule.PauseStatus = "" } _, err = w.QualityMonitors.Update(ctx, update) From 9d898c06b92c89c71992fb6eb165934386e5ff0a Mon Sep 17 00:00:00 2001 From: xinyijiang-db <158105497+xinyijiang-db@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:00:33 -0800 Subject: [PATCH 18/18] add schedule to two of the create monitor cases quality_monitor_test.go --- internal/acceptance/quality_monitor_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/acceptance/quality_monitor_test.go b/internal/acceptance/quality_monitor_test.go index d9e8a62c51..a0ebb198b0 100644 --- a/internal/acceptance/quality_monitor_test.go +++ b/internal/acceptance/quality_monitor_test.go @@ -64,6 +64,10 @@ func TestUcAccQualityMonitor(t *testing.T) { model_id_col = "model_id" problem_type = "PROBLEM_TYPE_REGRESSION" } + schedule=MonitorCronSchedule( + quartz_cron_expression="0 0 12 * * ?", # schedules a refresh every day at 12 noon + timezone_id="PST" + ) } resource "databricks_sql_table" "myTimeseries" { @@ -87,6 +91,10 @@ func TestUcAccQualityMonitor(t *testing.T) { granularities = ["1 day"] timestamp_col = "timestamp" } + schedule=MonitorCronSchedule( + quartz_cron_expression="0 0 12 * * ?", # schedules a refresh every day at 12 noon + timezone_id="PST" + ) } resource "databricks_sql_table" "mySnapshot" {