cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with SQL Alert Task in Databricks Asset Bundles: Unknown Alert ID and alerts-v2 URL Mismatch

Seunghyun
Contributor

Hello,

I have deployed a Databricks SQL Alert using Databricks Asset Bundles (DABs), and I’ve also deployed a Job to execute this alert through the same bundle.

Below is a snippet of the task configuration I used:
```
- task_key: "alerts_error"
sql_task:
alert:
alert_id: ${resources.alerts.MY_ALERT_NAME.id}
warehouse_id: ${resources.sql_warehouses.SERVERLESS_WH.id}
```

The deployment itself was successful. However, the task fails with the error: "The SQL entity could not be found." When I check the task configuration in the Databricks UI, the SQL alert is displayed as "unknown alert with ID: {my alert id}".

Furthermore, when I click the "Open alert" link in the SQL Alert section of the task execution page, it redirects to {HOST}/sql/alerts/{id}?o={workspace_id} and returns a "the request was invalid" error.

Interestingly, when I access the alert directly from the Alert console, the URL is {HOST}/sql/alerts-v2/{id}?o={workspace_id}. The difference seems to be the path: /alerts/ vs /alerts-v2/. It appears that the task is unable to locate the alert resource due to this path discrepancy.

Has anyone encountered a similar issue or found a solution for this?

1 ACCEPTED SOLUTION

Accepted Solutions

pradeep_singh
Contributor III

DABS bundle resources maps to SQL Alert V2 

https://docs.databricks.com/aws/en/dev-tools/bundles/resources#alert

So when you use DABS to create the alert it creates V2 alert . 

SQL Alert V2 are in public preview and not yet GA  ( https://docs.databricks.com/api/workspace/alertsv2#:~:text=Alerts%20V2%20API%20%7C%20REST%20API,Know...) which could be a reason internally the jobs UI and backend are still looking for alerts under /sql/alerts/{alert_id} . Also the definition of SQL Task does not have a way to pass Alerts V2 ( SQL Task params take alert id ( there is no options of alert v2) - https://docs.databricks.com/aws/en/dev-tools/bundles/job-task-types#sql-task)

I think until Alert V2 become GA you will continue to face this issue . 

Thank You
Pradeep Singh - https://www.linkedin.com/in/dbxdev

View solution in original post

3 REPLIES 3

pradeep_singh
Contributor III

DABS bundle resources maps to SQL Alert V2 

https://docs.databricks.com/aws/en/dev-tools/bundles/resources#alert

So when you use DABS to create the alert it creates V2 alert . 

SQL Alert V2 are in public preview and not yet GA  ( https://docs.databricks.com/api/workspace/alertsv2#:~:text=Alerts%20V2%20API%20%7C%20REST%20API,Know...) which could be a reason internally the jobs UI and backend are still looking for alerts under /sql/alerts/{alert_id} . Also the definition of SQL Task does not have a way to pass Alerts V2 ( SQL Task params take alert id ( there is no options of alert v2) - https://docs.databricks.com/aws/en/dev-tools/bundles/job-task-types#sql-task)

I think until Alert V2 become GA you will continue to face this issue . 

Thank You
Pradeep Singh - https://www.linkedin.com/in/dbxdev

@프라딥 Thanks for reply. I just keep my eye on the release note. 

 

pradeep_singh
Contributor III

You will probably have to come up with a solution that involves running the SQL that creates the alert instead of using DABS to create the alert until Alert V2 becomes GA . 

Thank You
Pradeep Singh - https://www.linkedin.com/in/dbxdev