CallVariant

View as Markdown

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.

CallVariant is a passthrough function.

The functions that can be used with a passthrough function depend on your connected data platform’s native SQL functions. For example, on Snowflake connections, browse the Snowflake SQL function reference to find functions that return a value that matches the datatype of the passthrough function.

With CallVariant, you can use a function that returns variant data.

This function isn’t compatible with all data platform connections. To check if your connection supports it, see Supported data platforms and feature compatibility.

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.