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

snowflake.snowpark.functions.array_insert

snowflake.snowpark.functions.array_insert(array: ColumnOrName, pos: ColumnOrName, element: ColumnOrName) Column[source]

Returns an ARRAY containing all elements from the source ARRAY as well as the new element.

Parameters:
  • array – Column containing the source ARRAY.

  • pos – Column containing a (zero-based) position in the source ARRAY. The new element is inserted at this position. The original element from this position (if any) and all subsequent elements (if any) are shifted by one position to the right in the resulting array (i.e. inserting at position 0 has the same effect as using array_prepend). A negative position is interpreted as an index from the back of the array (e.g. -1 results in insertion before the last element in the array).

  • element – Column containing the element to be inserted. The new element is located at position pos. The relative order of the other elements from the source array is preserved.