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

snowflake.snowpark.functions.struct

snowflake.snowpark.functions.struct(*cols: Union[Column, str]) Column[source]

Returns an OBJECT constructed with the given columns.

Example::
>>> from snowflake.snowpark.functions import struct
>>> df = session.createDataFrame([("Bob", 80), ("Alice", None)], ["name", "age"])
>>> res = df.select(struct("age", "name").alias("struct")).show()
---------------------
|"STRUCT"           |
---------------------
|{                  |
|  "age": 80,       |
|  "name": "Bob"    |
|}                  |
|{                  |
|  "age": null,     |
|  "name": "Alice"  |
|}                  |
---------------------
Copy