snowflake.snowpark.functions.as_time

snowflake.snowpark.functions.as_time(variant: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/functions.py#L7555-L7570)

Casts a VARIANT value to a time value.

Example:

>>> from snowflake.snowpark.functions import as_time, to_variant
>>> df = session.sql("select TO_TIME('12:34:56') as alarm")
>>> df.alarm_v = to_variant(df.alarm)
>>> df.select(df.alarm_v.as_("alarm")).collect() == df.select(df.alarm).collect()
False
>>> df.select(as_time(df.alarm_v).as_("alarm")).collect() == df.select(df.alarm).collect()
True
Copy
Language: English