snowflake.snowpark.functions.flatten¶
- snowflake.snowpark.functions.flatten(col: Union[Column, str], path: str = '', outer: bool = False, recursive: bool = False, mode: Literal['object', 'array', 'both'] = 'both') TableFunctionCall[source]¶
FLATTEN explodes compound values into multiple rows. This table function takes a VARIANT, OBJECT, or ARRAY column and produces a lateral view.
- Parameters:
col – Column object or string name of the desired column.
path – The path to the element within VARIANT data structure which needs to be flattened. Defaults to “”.
outer – When
False, any input rows that cannot be expanded are completely omitted from the output. WhenTrue, exactly one row s generated for zero-row expansions. Defaults toFalse.recursive – When
False, only the reference bypathis expanded. WhenTrue, the expansion is performed for all sub-elements recursively. Defaults toFalse.mode – Specifies whether only objects, arrays, or both should be flattened. Defaults to “both”.
- Examples::