snowflake.snowpark.functions.as_object¶
- snowflake.snowpark.functions.as_object(variant: Union[Column, str]) Column [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/functions.py#L7534-L7552)¶
Casts a VARIANT value to an object.
- Example::
>>> df = session.sql("select object_construct('A',1,'B','BBBB')::variant as a") >>> df.select(as_object("a").alias("result")).show() ----------------- |"RESULT" | ----------------- |{ | | "A": 1, | | "B": "BBBB" | |} | -----------------