From 707b2d62c9a98d75930d25905c2f56420f7350b3 Mon Sep 17 00:00:00 2001 From: Sebastien Biollo Date: Mon, 25 Mar 2024 17:17:28 +0100 Subject: [PATCH 1/2] add table update API --- bundle/internal/tf/schema/data_source_job.go | 8 ++++++++ bundle/internal/tf/schema/resource_job.go | 8 ++++++++ bundle/schema/docs/bundle_descriptions.json | 6 +++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/bundle/internal/tf/schema/data_source_job.go b/bundle/internal/tf/schema/data_source_job.go index 6e67b285f15..2ff98fa23b8 100644 --- a/bundle/internal/tf/schema/data_source_job.go +++ b/bundle/internal/tf/schema/data_source_job.go @@ -1202,9 +1202,17 @@ type DataSourceJobJobSettingsSettingsTriggerFileArrival struct { WaitAfterLastChangeSeconds int `json:"wait_after_last_change_seconds,omitempty"` } +type DataSourceJobJobSettingsSettingsTriggerTableUpdate struct { + TableNames []string `json:"table_names"` + Condition string `json:"condition,omitempty"` + MinTimeBetweenTriggersSeconds int32 `json:"min_time_between_triggers_seconds,omitempty"` + WaitAfterLastChangeSeconds int32 `json:"wait_after_last_change_seconds,omitempty"` +} + type DataSourceJobJobSettingsSettingsTrigger struct { PauseStatus string `json:"pause_status,omitempty"` FileArrival *DataSourceJobJobSettingsSettingsTriggerFileArrival `json:"file_arrival,omitempty"` + TableUpdate *DataSourceJobJobSettingsSettingsTriggerTableUpdate `json:"table_update,omitempty"` } type DataSourceJobJobSettingsSettingsWebhookNotificationsOnDurationWarningThresholdExceeded struct { diff --git a/bundle/internal/tf/schema/resource_job.go b/bundle/internal/tf/schema/resource_job.go index f8d08aefab1..68597895b08 100644 --- a/bundle/internal/tf/schema/resource_job.go +++ b/bundle/internal/tf/schema/resource_job.go @@ -1202,9 +1202,17 @@ type ResourceJobTriggerFileArrival struct { WaitAfterLastChangeSeconds int `json:"wait_after_last_change_seconds,omitempty"` } +type ResourceJobTriggerTableUpdate struct { + TableNames []string `json:"table_names"` + Condition string `json:"condition,omitempty"` + MinTimeBetweenTriggersSeconds int32 `json:"min_time_between_triggers_seconds,omitempty"` + WaitAfterLastChangeSeconds int32 `json:"wait_after_last_change_seconds,omitempty"` +} + type ResourceJobTrigger struct { PauseStatus string `json:"pause_status,omitempty"` FileArrival *ResourceJobTriggerFileArrival `json:"file_arrival,omitempty"` + TableUpdate *ResourceJobTriggerTableUpdate `json:"table_update,omitempty"` } type ResourceJobWebhookNotificationsOnDurationWarningThresholdExceeded struct { diff --git a/bundle/schema/docs/bundle_descriptions.json b/bundle/schema/docs/bundle_descriptions.json index c6b45a3eb97..2faba071629 100644 --- a/bundle/schema/docs/bundle_descriptions.json +++ b/bundle/schema/docs/bundle_descriptions.json @@ -1553,7 +1553,7 @@ "pause_status": { "description": "Whether this trigger is paused or not." }, - "table": { + "table_update": { "description": "Table trigger settings.", "properties": { "condition": { @@ -1565,7 +1565,7 @@ "table_names": { "description": "A list of Delta tables to monitor for changes. The table name must be in the format `catalog_name.schema_name.table_name`.", "items": { - "description": "" + "description": "A Delta tables to monitor for changes. Must be in the format `catalog_name.schema_name.table_name`." } }, "wait_after_last_change_seconds": { @@ -5270,4 +5270,4 @@ } } } -} \ No newline at end of file +} From b8bbbc4bd0ff906e34a0f1e46967e009610e8dce Mon Sep 17 00:00:00 2001 From: Sebastien Biollo Date: Mon, 25 Mar 2024 17:23:40 +0100 Subject: [PATCH 2/2] add test --- bundle/config/mutator/process_target_mode_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bundle/config/mutator/process_target_mode_test.go b/bundle/config/mutator/process_target_mode_test.go index 17f83816085..2d6cf4e366a 100644 --- a/bundle/config/mutator/process_target_mode_test.go +++ b/bundle/config/mutator/process_target_mode_test.go @@ -80,6 +80,17 @@ func mockBundle(mode config.Mode) *bundle.Bundle { }, }, }, + "job5": { + JobSettings: &jobs.JobSettings{ + Name: "job3", + Trigger: &jobs.TriggerSettings{ + TableUpdate: &jobs.TableUpdateTriggerConfiguration{ + TableNames: []string{"catalog.schema.table1", "catalog.schema.table2"}, + Condition: "ALL_UPDATED", + }, + }, + }, + }, }, Pipelines: map[string]*resources.Pipeline{ "pipeline1": {PipelineSpec: &pipelines.PipelineSpec{Name: "pipeline1"}},