Merk
Tilgang til denne siden krever autorisasjon. Du kan prøve å logge på eller endre kataloger.
Tilgang til denne siden krever autorisasjon. Du kan prøve å endre kataloger.
Note
Databricks CLI use is subject to the Databricks License and Databricks Privacy Notice, including any Usage Data provisions.
The alerts-v2 command group within the Databricks CLI allows you to manage SQL alerts. An alert periodically runs a query, evaluates a condition of its result, and notifies one or more users and/or notification destinations if the condition was met.
databricks alerts-v2 create-alert
Create an alert.
databricks alerts-v2 create-alert DISPLAY_NAME QUERY_TEXT WAREHOUSE_ID EVALUATION SCHEDULE [flags]
Arguments
DISPLAY_NAME
The display name of the alert.
QUERY_TEXT
Text of the query to be run.
WAREHOUSE_ID
ID of the SQL warehouse attached to the alert.
EVALUATION
The evaluation condition for the alert.
SCHEDULE
The schedule for running the alert query.
Options
--custom-description string
Custom description for the alert.
--custom-summary string
Custom summary for the alert.
--json JSON
The inline JSON string or the @path to the JSON file with the request body.
--parent-path string
The workspace path of the folder containing the alert.
--run-as-user-name string
The run as username or application ID of service principal.
Examples
The following example creates an alert using a JSON file:
databricks alerts-v2 create-alert "High CPU Alert" "SELECT cpu_usage FROM metrics" "abc123" @evaluation.json @schedule.json --json @alert.json
databricks alerts-v2 get-alert
Get an alert.
databricks alerts-v2 get-alert ID [flags]
Arguments
ID
The UUID of the alert to retrieve.
Options
Examples
The following example gets an alert by ID:
databricks alerts-v2 get-alert 12345678-1234-1234-1234-123456789012
databricks alerts-v2 list-alerts
List alerts. Gets a list of alerts accessible to the user, ordered by creation time.
databricks alerts-v2 list-alerts [flags]
Arguments
None
Options
--page-size int
The maximum number of alerts to return.
--page-token string
A page token from a previous list call to retrieve the next page.
Examples
The following example lists all accessible alerts:
databricks alerts-v2 list-alerts
databricks alerts-v2 trash-alert
Delete an alert. Moves an alert to the trash. Trashed alerts immediately disappear from list views, and can no longer trigger. You can restore a trashed alert through the UI. A trashed alert is permanently deleted after 30 days.
databricks alerts-v2 trash-alert ID [flags]
Arguments
ID
The UUID of the alert to trash.
Options
--purge
Whether to permanently delete the alert.
Examples
The following example trashes an alert:
databricks alerts-v2 trash-alert 12345678-1234-1234-1234-123456789012
The following example permanently deletes an alert:
databricks alerts-v2 trash-alert 12345678-1234-1234-1234-123456789012 --purge
databricks alerts-v2 update-alert
Update an alert.
databricks alerts-v2 update-alert ID UPDATE_MASK DISPLAY_NAME QUERY_TEXT WAREHOUSE_ID EVALUATION SCHEDULE [flags]
Arguments
ID
UUID identifying the alert.
UPDATE_MASK
The field mask specifying which fields to update. Use comma-separated field names. Use * to update all fields.
DISPLAY_NAME
The display name of the alert.
QUERY_TEXT
Text of the query to be run.
WAREHOUSE_ID
ID of the SQL warehouse attached to the alert.
EVALUATION
The evaluation condition for the alert.
SCHEDULE
The schedule for running the alert query.
Options
--custom-description string
Custom description for the alert.
--custom-summary string
Custom summary for the alert.
--json JSON
The inline JSON string or the @path to the JSON file with the request body.
--parent-path string
The workspace path of the folder containing the alert.
--run-as-user-name string
The run as username or application ID of service principal.
Examples
The following example updates an alert's display name:
databricks alerts-v2 update-alert 12345678-1234-1234-1234-123456789012 display_name "Updated Alert Name" "SELECT cpu_usage FROM metrics" "abc123" @evaluation.json @schedule.json
Global flags
--debug
Whether to enable debug logging.
-h or --help
Display help for the Databricks CLI or the related command group or the related command.
--log-file string
A string representing the file to write output logs to. If this flag is not specified then the default is to write output logs to stderr.
--log-format format
The log format type, text or json. The default value is text.
--log-level string
A string representing the log format level. If not specified then the log format level is disabled.
-o, --output type
The command output type, text or json. The default value is text.
-p, --profile string
The name of the profile in the ~/.databrickscfg file to use to run the command. If this flag is not specified then if it exists, the profile named DEFAULT is used.
--progress-format format
The format to display progress logs: default, append, inplace, or json
-t, --target string
If applicable, the bundle target to use