CallVariant

The CallVariant function calls a warehouse function that returns a Variant datatype. This function can be used in the case of string tokenization for cleaning unstructured text data.Β 

Syntax

CallVariant(function name, argument1, argument2, ...)

Function arguments:

  • function name (required): The name of the warehouse function to call.
  • argument (required): The argument(s) to pass into the warehouse function. Multiple arguments are supported.Β 

Example

A table contains a Product Name column that returns product information as a string. You can pass Snowflake's STRTOK_TO_ARRAY function to the CallVariant function to tokenize the Product Name string by a delimiter and return the tokens in an array.

CallVariant("STRTOK_TO_ARRAY", [Product Name], "-")
  • Returns an array that splits Product Name into Product ID, Name, and Color tokens

You can use the CallVariant column to extract the desired fields for each product into their individual columns for further analysis.