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

snowflake.snowpark.functions.as_char¶

snowflake.snowpark.functions.as_char(variant: Union[Column, str]) → Column[source]¶

Casts a VARIANT value to a string.

Example:

>>> from snowflake.snowpark.functions import as_char, to_variant
>>> df = session.sql("select 'some string' as char")
>>> df.char_v = to_variant(df.char)
>>> df.select(df.char_v.as_("char")).collect() == df.select(df.char).collect()
False
>>> df.select(as_char(df.char_v).as_("char")).collect() == df.select(df.char).collect()
True
Copy