snowflake.snowpark.functions.as_varchar¶
- snowflake.snowpark.functions.as_varchar(variant: Union[Column, str]) Column [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/functions.py#L7324-L7339)¶
Casts a VARIANT value to a string.
Example:
>>> from snowflake.snowpark.functions import as_varchar, 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_varchar(df.char_v).as_("char")).collect() == df.select(df.char).collect() True