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

snowflake.snowpark.functions.object_keys¶

snowflake.snowpark.functions.object_keys(obj: ColumnOrName) → Column[source]¶

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