EXTERNAL FUNCTION

Config path: /<database>/<schema>/external_function/<name>(<dtypes>).yaml

Example:

arguments:
  string_col: VARCHAR(255)

returns: VARIANT

api_integration: test_api_integration
url: https://xyz.execute-api.us-west-2.amazonaws.com/production/remote_echo

Schema

  • arguments (dict)

    • {key} (ident) - argument name

    • {value} (str) - argument data type

  • returns (str) - for single return value, return data type

  • api_integration (ident) - name of API integration

  • url (str) - invocation URL of proxy service

  • is_secure (bool) - is function SECURE

  • is_strict (bool) - is function STRICT (always returns NULL on NULL input)

  • is_immutable (bool) - is function IMMUTABLE (same input always produced the same output)

  • headers (dict)

    • {key} (str) - header name

    • {value} (str) - header value

  • context_headers (list)

    • {items} (ident) - context function name

  • max_batch_rows (int) - maximum number of rows in each batch sent to the proxy service

  • comment (str)

Usage notes

  1. Snowflake supports overloading of function names. Multiple functions may have the same name as long as they have different arguments. It is required to use comma-separated base data types of arguments in config names. For example: my_function(number).yaml, my_function(varchar,number).yaml

  2. API integration should be created and granted to SnowDDL admin role manually prior to execution.

Additional privileges

In order for EXTERNAL FUNCTION objects to operate properly, the following additional grants should be added to OWNER role in schema config:

  • owner_integration_usage - please specify names of API INTEGRATION objects used by external functions. Functions may work without explicit INTEGRATION USAGE grant to OWNER role, but it is not guaranteed for Snowflake keep it this way forever.

Last updated