snowflake.snowpark.functions.object_construct¶ snowflake.snowpark.functions.object_construct(*key_values: Union[Column, str]) → Column[source] (https://github.com/snowflakedb/snowpark-python/blob/release-v1.12.1/src/snowflake/snowpark/functions.py#L5480-L5506)¶ Returns an OBJECT constructed from the arguments. Example: CopyExpand>>> from snowflake.snowpark.types import StructType, StructField, VariantType, StringType >>> df = session.create_dataframe( ... [["name", "Joe"], ["zip", "98004"],["age", None], [None, "value"]], ... schema=StructType([StructField("k", StringType()), StructField("v", VariantType())]) ... ) >>> df.select(object_construct(col("k"), col("v")).alias("result")).show() -------------------- |"RESULT" | -------------------- |{ | | "name": "Joe" | |} | |{ | | "zip": "98004" | |} | |{} | |{} | -------------------- Show lessSee moreScroll to top