snowflake.snowpark.functions.array_contains

snowflake.snowpark.functions.array_contains(variant: Union[Column, str], array: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.44.0/src/snowflake/snowpark/functions.py#L7203-L7232)

Returns True if the specified VARIANT is found in the specified ARRAY.

Parameters:
  • variant – Column containing the VARIANT to find.

  • array

    Column containing the ARRAY to search.

    If this is a semi-structured array, you’re required to explicitly cast the following SQL types into a VARIANT:

Example::
>>> from snowflake.snowpark import Row
>>> df = session.create_dataframe([Row(["apple", "banana"]), Row(["apple", "orange"])], schema=["a"])
>>> df.select(array_contains(lit("banana").cast("variant"), "a").alias("result")).show()
------------
|"RESULT"  |
------------
|True      |
|False     |
------------
Copy
Language: English