.alter function.alter function

更改现有函数并将其存储在数据库元数据中。Alters an existing function and stores it inside the database metadata. 参数类型和 CSL 语句的规则与 let 语句的规则相同。Rules for parameter types and CSL statements are the same as for let statements.


.alter function [with (docstring = '<description>', folder='<name>', skipvalidation='true')] [FunctionName] ([paramName:paramType], ...) { CSL-statement }
输出参数Output parameter 类型Type 说明Description
名称Name StringString 函数的名称。The name of the function.
parametersParameters StringString 函数所需的参数。The parameters required by the function.
正文Body StringString (零个或多个)let 语句,后跟有效的 CSL 表达式,该表达式在函数调用时求值。(Zero or more) let statements followed by a valid CSL expression that is evaluated upon function invocation.
文件夹Folder StringString 用于 UI 函数分类的文件夹。A folder used for UI functions categorization. 此参数不会更改调用函数的方式。This parameter does not change the way function is invoked.
DocStringDocString StringString 用于 UI 目的的函数说明。A description of the function for UI purposes.


  • 如果该函数不存在,将返回错误。If the function doesn't exist, an error is returned. 若要创建新函数,请参阅 .create 函数For creating a new function, see .create function
  • 需要数据库管理员权限Requires database admin permission
  • 允许最初创建该函数的数据库用户修改函数。The database user who originally created the function is allowed to modify the function.
  • let 语句并不支持所有的 Kusto 类型。Not all Kusto types are supported in let statements. 支持的类型为:字符串、长整型、日期时间、时间跨度和双精度型。Supported types are: string, long, datetime, timespan, and double.
  • 使用 skipvalidation 跳过函数的语义验证。Use skipvalidation to skip semantic validation of the function. 如果以不正确的顺序创建函数,并且之前创建了使用 F2 的 F1,这会很有用。This is useful when functions are created in an incorrect order and F1 that uses F2 is created earlier.


.alter function
with (docstring = 'Demo function with parameter', folder='MyFolder')
 MyFunction2(myLimit: long)  {StormEvents | limit myLimit}
名称Name parametersParameters 正文Body 文件夹Folder DocStringDocString
MyFunction2MyFunction2 (myLimit: long)(myLimit: long) {StormEvents | limit myLimit}{StormEvents | limit myLimit} MyFolderMyFolder 带参数的演示函数Demo function with parameter