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

snowflake.snowpark.functions.array_prepend¶

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

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

Parameters:
  • ARRAY. (array Column containing the source) –

  • prepended. (element Column containing the element to be) –

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