From e6e36630b8d26622ee2ca0622973de38018fd1d2 Mon Sep 17 00:00:00 2001 From: Qinyi Ding Date: Tue, 29 Sep 2026 23:22:06 -0700 Subject: [PATCH] [DOC-11506] Add collect Row access examples Clarify existing API behavior without changing executable code. Generated with [Snowflake CoCo](https://docs.snowflake.com/en/user-guide/cortex-code/cortex-code) Co-authored-by: Snowflake CoCo --- src/snowflake/snowpark/dataframe.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/snowflake/snowpark/dataframe.py b/src/snowflake/snowpark/dataframe.py index 1ea2be27c8..55560f03ae 100644 --- a/src/snowflake/snowpark/dataframe.py +++ b/src/snowflake/snowpark/dataframe.py @@ -814,6 +814,22 @@ def collect( See also: :meth:`collect_nowait()` + + The default blocking call retrieves all result rows into client memory. + For large results, consider :meth:`to_local_iterator` instead of + materializing a list. Use :meth:`sort` before collecting when the order + of rows matters. + + Example:: + + >>> df = session.create_dataframe([(2, "Bob"), (1, "Alice")], schema=["id", "name"]) + >>> rows = df.sort("id").collect() + >>> rows + [Row(ID=1, NAME='Alice'), Row(ID=2, NAME='Bob')] + >>> rows[0]["NAME"] + 'Alice' + >>> rows[1].ID + 2 """ kwargs = {}