import Session from snowflake.snowpark.functions import date_trunc, col connection_parameters = { "account": “**********.aws.ap-northeast-1", "user": *****@datumstudio.jp", "password": “*******", … } session = Session.builder.configs(connection_parameters).create() customer_order = session.table("raw_orders") ¥ .select("user_id", date_trunc("MONTH", "order_date").alias("month")) ¥ .group_by("month", "user_id") ¥ .count() ¥ .show() $ python test.py ------------------------------------ |"MONTH" |"USER_ID" |"COUNT" | ------------------------------------ |2018-01-01 |1 |1 | |2018-01-01 |3 |2 | |2018-01-01 |94 |2 | |2018-01-01 |50 |1 | |2018-01-01 |64 |2 | |2018-01-01 |54 |2 | |2018-01-01 |88 |1 | |2018-01-01 |2 |1 | |2018-01-01 |53 |1 | |2018-01-01 |7 |1 | ------------------------------------