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

[FEATURE] Add subscriptions to SQL Alert job tasks #2436

Closed
orolega opened this issue Jun 28, 2023 · 7 comments · Fixed by #2447
Closed

[FEATURE] Add subscriptions to SQL Alert job tasks #2436

orolega opened this issue Jun 28, 2023 · 7 comments · Fixed by #2447
Assignees
Labels
feature New feature or request needs-api changes to Databricks Platform APIs are required

Comments

@orolega
Copy link

orolega commented Jun 28, 2023

Use-cases

Currently there is no way of adding subscriptions (destinations and users) to an alert itself. This must be done via the GUI. However API also does not appear to have this functionality for alerts. There are SQL alert tasks in a job where you can also define subscriptions. These jobs also allow you to schedule when to check the alert (feature also missing on just an alert object in the api and thus terraform). However still lacks the ability to define those subscriptions in the terraform resource. It is possible to define them if creating the job via the API.

So ultimately the use case is being able to add subscriptions to alerts beyond just the creator of them.

Attempted Solutions

No solution possible given existing features. Must use the API directly

Proposal

Enable the functionality of the Job API that adds subscriptions to the existing SQL Alert Task resource

References

@orolega orolega added the feature New feature or request label Jun 28, 2023
@alexott alexott added the needs-api changes to Databricks Platform APIs are required label Jun 28, 2023
@alexott
Copy link
Contributor

alexott commented Jun 28, 2023

duplicate of #1983

@orolega
Copy link
Author

orolega commented Jun 29, 2023

duplicate of #1983

Not a duplicate given what I am proposing does have an API endpoint. You claim it does not.

TBH I think its just adding the subscriptions object here

from the API documentation. Sorry the formatting is off:

alert object

If alert, indicates that this job must refresh a SQL alert.

alert_id required string

The canonical identifier of the SQL alert.

subscriptions

Array of objects

If specified, alert notifications are sent to subscribers.

Array

user_name string

The user name to receive the subscription email.

destination_id string

The canonical identifier of the destination to receive email notification.

pause_subscriptions boolean

If true, the alert notifications are not sent to subscribers.

@orolega
Copy link
Author

orolega commented Jun 29, 2023

definitely not a duplicate. The other ticket is about creating a destination. I am requesting assigning an existing one to the list of subscriptions when creating a SQL alert task. See the below screen cap

image

@orolega
Copy link
Author

orolega commented Jun 29, 2023

Currently the terraform resource only has alert - (Optional) block consisting of single string field: alert_id - identifier of the Databricks SQL Alert.

subscriptions and pause_subscriptions should be added per the API

@alexott
Copy link
Contributor

alexott commented Jun 29, 2023

ah, sorry - misread it...

@alexott alexott self-assigned this Jun 29, 2023
alexott added a commit that referenced this issue Jun 29, 2023
…ks_job`

It's now possible to subscribe to updates of individual dashboards & alerts in the SQL
tasks of Databricks Workflows

This fixes #2436
@orolega
Copy link
Author

orolega commented Jun 29, 2023

beat me to a PR. spent some time yesterday figuring this out. Was trying to test the binary locally to be sure... Anyways, thanks for solving this!

@alexott
Copy link
Contributor

alexott commented Jun 30, 2023

for development you can use this approach: https://developer.hashicorp.com/terraform/cli/config/config-file#development-overrides-for-provider-developers

but frankly speaking, we had some problems with docs, so it would be hard to get it correct using only the api spec.

alexott added a commit that referenced this issue Jul 5, 2023
…ks_job`

It's now possible to subscribe to updates of individual dashboards & alerts in the SQL
tasks of Databricks Workflows

This fixes #2436
mgyucht pushed a commit that referenced this issue Jul 6, 2023
…atabricks_job` (#2447)

* Add ability to subscribe to dashboards & alert SQL tasks in `databricks_job`

It's now possible to subscribe to updates of individual dashboards & alerts in the SQL
tasks of Databricks Workflows

This fixes #2436

* Add unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request needs-api changes to Databricks Platform APIs are required
Projects
None yet
2 participants