You are viewing documentation about an older version (1.12.1). View latest version

snowflake.snowpark.functions.array_to_string

snowflake.snowpark.functions.array_to_string(array: Union[Column, str], separator: Union[Column, str]) Column[source]

Returns an input ARRAY converted to a string by casting all values to strings (using TO_VARCHAR) and concatenating them (using the string from the second argument to separate the elements).

Parameters:
  • array – Column containing the ARRAY of elements to convert to a string.

  • separator – Column containing the string to put between each element (e.g. a space, comma, or other human-readable separator).

Example::
>>> from snowflake.snowpark import Row
>>> df = session.create_dataframe([Row(a=[1, True, "s"])])
>>> df.select(array_to_string("a", lit(",")).alias("result")).show()
------------
|"RESULT"  |
------------
|1,true,s  |
------------
Copy