snowflake.snowpark.functions.object_keys¶
- snowflake.snowpark.functions.object_keys(obj: Union[Column, str]) Column [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/functions.py#L7767-L7797)¶
Returns an array containing the list of keys in the input object.
- Example::
>>> from snowflake.snowpark.functions import lit >>> df = session.sql( ... "select object_construct(a,b,c,d,e,f) as obj, k, v from " ... "values('age', 21, 'zip', 21021, 'name', 'Joe', 'age', 0)," ... "('age', 26, 'zip', 94021, 'name', 'Jay', 'age', 0) as T(a,b,c,d,e,f,k,v)" ... ) >>> df.select(object_keys(col("obj")).alias("result")).show() ------------- |"RESULT" | ------------- |[ | | "age", | | "name", | | "zip" | |] | |[ | | "age", | | "name", | | "zip" | |] | -------------