为 GCP 调用外部函数

本主题介绍如何调用外部函数:

  1. If appropriate, grant USAGE privilege on the external function to one or more Snowflake roles so that the roles can call the external function. A role must have USAGE or OWNERSHIP privileges on that external function.

  2. 像执行任何 UDF 一样调用外部函数。例如,如果创建 Snowflake 提供的示例函数:

    select my_external_function(42, 'Life, the Universe, and Everything');

    If you customized the function name when you created the function, then replace my_external_function with the customized name.

返回值应类似于:

[42, "Life, the Universe, and Everything"]

Note

外部函数是架构对象,因此包含该函数的架构必须在会话中使用,或者必须在调用函数时指定函数的完全限定名称。