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

snowflake.snowpark.functions.strtok_to_array

snowflake.snowpark.functions.strtok_to_array(text: Column | str, delimiter: Column | str | None = None) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/release-v1.5.0/src/snowflake/snowpark/functions.py#L2125-L2151)

Tokenizes the given string using the given set of delimiters and returns the tokens as an array.

If either parameter is a NULL, a NULL is returned. An empty array is returned if tokenization produces no tokens.

Example::
>>> df = session.create_dataframe(
...     [["a.b.c", "."], ["1,2.3", ","]],
...     schema=["text", "delimiter"],
... )
>>> df.select(strtok_to_array("text", "delimiter").alias("TIME_FROM_PARTS")).collect()
[Row(TIME_FROM_PARTS='[\n  "a",\n  "b",\n  "c"\n]'), Row(TIME_FROM_PARTS='[\n  "1",\n  "2.3"\n]')]
Copy
Language: English