- Categories:
System functions (System Information)
SYSTEM$GET_ ALERT_ TEMPLATE¶
Returns the definition of a single alert template, including the variables you can set, their data types, defaults, allowed values, and a ready-to-adapt example statement.
Use SYSTEM$LIST_ALERT_TEMPLATES to discover template identifiers, then use this function to inspect a template before you create an alert with CREATE ALERT … FROM TEMPLATE.
Syntax¶
Arguments¶
template_idThe identifier of the template to return, as reported by SYSTEM$LIST_ALERT_TEMPLATES.
The identifier is not case-sensitive. The returned payload reports the canonical identifier in
template_id.
Returns¶
Returns a JSON object with a single template field. The template object includes the same
metadata that SYSTEM$LIST_ALERT_TEMPLATES
reports for each template (template_id, template_version, display_name, alert_description,
product, supports_new_data_schedule, default_schedule, scope, subcategories, runbook),
plus the following:
template_variables. An array describing each variable you can set through theTEMPLATE_PARAMSclause. Each variable has:name. The variable name to use as a key inTEMPLATE_PARAMS.display_name. A human-readable name.description. Help text describing the variable.data_type. The value type:STRING,NUMBER, orINTEGER.semantic_type. The value category, such asPERCENTAGE,DURATION_HOURS,COUNT, orPLAIN_TEXT.default_value. The value used when you omit the variable.optional. Present andtruewhen the variable is optional. Omitted otherwise.options. For variables that accept a fixed set of values, the array of allowed values (for example,["ACCOUNT", "DATABASE", "SCHEMA"]for a monitoring scope).min,max,exclusive_min. For numeric variables that have a range, the lower bound, the upper bound, and whether the lower bound is exclusive. Fields are omitted when they don’t apply.
create_syntax. A ready-to-adapt CREATE ALERT … FROM TEMPLATE statement for the template, prefilled with defaults and sample values. Replace the placeholder object names before you run it.alert_definition_template. The raw template body. This field is informational. You do not need it to create an alert with theFROM TEMPLATEclause.
Usage notes¶
- This is a read-only function. It does not require a running warehouse.
- A variable is required when it lacks both a
default_valueand anoptional: trueflag. There is no separaterequiredfield: requiredness is derived fromdefault_valueandoptional. - The
optionsandmin/maxfields advertise exactly what the CREATE ALERT … FROM TEMPLATE clause enforces, so you can use them to build a validTEMPLATE_PARAMSvalue before you run the statement. - If the template ID doesn’t exist or you don’t have access to it, the function returns an object does not exist or not authorized error. Verify the identifier with SYSTEM$LIST_ALERT_TEMPLATES.
Examples¶
Inspect the TASKS_ERROR_RATE template:
The function returns a JSON object similar to the following (abbreviated):
In this example, ERROR_RATE_THRESHOLD must be between 0 and 1, SCOPE_ACTIVE must be one of
ACCOUNT, DATABASE, or SCHEMA, and NOTIFICATION_MODE must be EMAIL or WEBHOOK. Because no
variable lacks a default_value, every variable is optional for this template.