snowflake.snowpark.functions.struct¶
- snowflake.snowpark.functions.struct(*cols: Union[Column, str]) Column [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L2383-L2431)¶
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" | |} | ---------------------