.alter function command

Applies to: ✅ Microsoft FabricAzure Data Explorer

Alters an existing function and stores it inside the database metadata. Rules for parameter types and CSL statements are the same as for let statements.

Permissions

You must have at least Function Admin permissions to run this command. The principal that creates the function is automatically made a Function Admin.

Syntax

.alter function [ with ( propertyName = propertyValue [, ...])] functionName(parameters) { body }

Learn more about syntax conventions.

Parameters

Name Type Required Description
functionName string ✔️ The name of the function to alter.
propertyName, propertyValue string A comma-separated list of key-value property pairs. See supported properties.
parameters string A comma-separated list of parameters required by the function. The format for each parameter must be ParameterName:ParameterDataType.
body string ✔️ Zero or more let statements followed by a valid CSL expression that is evaluated upon function invocation.

Note

  • If the function doesn't exist, an error is returned. For creating a new function, see .create function
  • Not all Kusto types are supported in let statements. Supported types are: string, long, datetime, timespan, and double.

Supported properties

Name Type Description
docstring string A description of the function for UI purposes.
folder string The name of a folder used for UI functions categorization.
view bool Designates this function as a stored view. Stored views can participate in search and union * scenarios. For more information, see Views.
skipvalidation bool Determines whether to run validation logic on the function and fails the process if the function isn't valid. The default is false.

Example

The following example modifies the MyFunction2 function with a description (docstring), folder, and defines the MyLimit parameter.

.alter function
with (docstring = 'Demo function with parameter', folder='MyFolder')
MyFunction2(myLimit: long)  
{StormEvents | take myLimit}
Name Parameters Body Folder DocString
MyFunction2 (myLimit: long) {StormEvents | take myLimit} MyFolder Demo function with parameter