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

snowflake.snowpark.functions.array_append¶

snowflake.snowpark.functions.array_append(array: Union[Column, str], element: Union[Column, str]) → Column[source]¶

Returns an ARRAY containing all elements from the source ARRAY as well as the new element. The new element is located at end of the ARRAY.

Parameters:
  • array – The column containing the source ARRAY.

  • element – The column containing the element to be appended. The element may be of almost any data type. The data type does not need to match the data type(s) of the existing elements in the ARRAY.

Example::
>>> from snowflake.snowpark import Row
>>> df = session.create_dataframe([Row(a=[1, 2, 3])])
>>> df.select(array_append("a", lit(4)).alias("result")).show()
------------
|"RESULT"  |
------------
|[         |
|  1,      |
|  2,      |
|  3,      |
|  4       |
|]         |
------------
Copy