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

snowflake.snowpark.functions.length

snowflake.snowpark.functions.length(e: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L2137-L2150)

Returns the length of an input string or binary value. For strings, the length is the number of characters, and UTF-8 characters are counted as a single character. For binary, the length is the number of bytes.

Example:

>>> df = session.create_dataframe(["the sky is blue", "WE CAN HANDLE THIS", "ÄäÖößÜü", None], schema=["a"])
>>> df.select(length(df["a"]).alias("length")).collect()
[Row(LENGTH=15), Row(LENGTH=18), Row(LENGTH=7), Row(LENGTH=None)]
Copy
Language: English