Share via


alerts command group

Note

This information applies to Databricks CLI versions 0.205 and above. The Databricks CLI is in Public Preview.

Databricks CLI use is subject to the Databricks License and Databricks Privacy Notice, including any Usage Data provisions.

The alerts command group within the Databricks CLI contains commands to perform get, create, update, and delete operations on alerts. An alert is a Databricks SQL object that 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. See Databricks SQL alerts.

databricks alerts create

Create an alert.

databricks alerts create [flags]

Options

--auto-resolve-display-name

    If true, automatically resolve alert display name conflicts.

--json JSON

    The inline JSON string or the @path to the JSON file with the request body

Global flags

Examples

The following example creates an alert using JSON:

databricks alerts create --json '{"name": "High CPU Alert", "query_id": "12345", "condition": {"op": "GREATER_THAN", "operand": {"column": {"name": "cpu_usage"}}, "threshold": {"value": {"double_value": 80}}}}'

The following example creates an alert using a JSON file:

databricks alerts create --json @alert.json

databricks alerts delete

Moves an alert to the trash. Trashed alerts immediately disappear from searches and 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 delete ID [flags]

Arguments

ID

    The ID of the alert to delete.

Options

Global flags

Examples

The following example deletes an alert by ID:

databricks alerts delete 12345

databricks alerts get

Get an alert.

databricks alerts get ID [flags]

Arguments

ID

    The ID of the alert to get.

Options

Global flags

Examples

The following example gets an alert by ID:

databricks alerts get 12345

databricks alerts list

List alerts accessible to the user, ordered by creation time.

Important

Running this command concurrently 10 or more times could result in throttling, service degradation, or a temporary ban.

databricks alerts list [flags]

Options

--page-size int

    Maximum number of alerts to return per page.

--page-token string

    Token to retrieve the next page of results.

Global flags

Examples

The following example lists all alerts:

databricks alerts list

The following example lists alerts with pagination:

databricks alerts list --page-size 10

databricks alerts update

Update an alert.

databricks alerts update ID UPDATE_MASK [flags]

Arguments

ID

    The ID of the alert to update.

UPDATE_MASK

    The field mask must be a single string, with multiple fields separated by commas (no spaces). The field path is relative to the resource object, using a dot (.) to navigate sub-fields (e.g., author.given_name). Specification of elements in sequence or map fields is not allowed, as only the entire collection field can be specified. Field names must exactly match the resource field names.

    An asterisk (*) field mask indicates full replacement. It's recommended to always explicitly list the fields being updated and avoid using wildcards, as it can lead to unintended results if the API changes in the future.

Options

--auto-resolve-display-name

    If true, automatically resolve alert display name conflicts.

--json JSON

    The inline JSON string or the @path to the JSON file with the request body

Global flags

Examples

The following example updates an alert using JSON:

databricks alerts update 12345 "name,condition" --json '{"name": "Updated Alert Name", "condition": {"op": "GREATER_THAN", "operand": {"column": {"name": "cpu_usage"}}, "threshold": {"value": {"double_value": 90}}}}'

The following example updates an alert using a JSON file:

databricks alerts update 12345 "name,condition" --json @update-alert.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