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

snowflake.snowpark.GroupingSets

class snowflake.snowpark.GroupingSets(*sets: Union[Column, List[Column]])[source]

Bases: object

Creates a GroupingSets object from a list of column/expression sets that you pass to DataFrame.group_by_grouping_sets(). See DataFrame.group_by_grouping_sets() for examples of how to use this class with a DataFrame. See GROUP BY GROUPING SETS for its counterpart in SQL (several examples are shown below).

Python interface

SQL interface

GroupingSets([col("a")], [col("b")])

GROUPING SETS ((a), (b))

GroupingSets([col("a") , col("b")], [col("c"), col("d")])

GROUPING SETS ((a, b), (c, d))

GroupingSets([col("a"), col("b")])

GROUPING SETS ((a, b))

GroupingSets(col("a"), col("b"))

GROUPING SETS ((a, b))