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

snowflake.snowpark.functions.as_object¶

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

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"  |
|}              |
-----------------
Copy