snowflake.snowpark.DataFrame.to_local_iterator¶

DataFrame.to_local_iterator(*, statement_params: Optional[Dict[str, str]] = None, block: bool = True, case_sensitive: bool = True, _emit_ast: bool = True) → Iterator[Row][source]¶
DataFrame.to_local_iterator(*, statement_params: Optional[Dict[str, str]] = None, block: bool = False, case_sensitive: bool = True, _emit_ast: bool = True) → AsyncJob

Executes the query representing this DataFrame and returns an iterator of Row objects that you can use to retrieve the results.

Unlike collect(), this method does not load all data into memory at once.

Example:

>>> df = session.table("prices")
>>> for row in df.to_local_iterator():
...     print(row)
Row(PRODUCT_ID='id1', AMOUNT=Decimal('10.00'))
Row(PRODUCT_ID='id2', AMOUNT=Decimal('20.00'))
Copy
Parameters:
  • statement_params – Dictionary of statement level parameters to be set while executing this action.

  • block – A bool value indicating whether this function will wait until the result is available. When it is False, this function executes the underlying queries of the dataframe asynchronously and returns an AsyncJob.

  • case_sensitive – A bool value which controls the case sensitivity of the fields in the Row objects returned by the to_local_iterator. Defaults to True.