iter_chunk_dict
iter_chunk_dict returns a generator that reads a chunk of rows at a time from a table into a dictionary. The dictionary is a map of column names to NumPy arrays of values.
If locking is not explicitly specified, this method will automatically lock to ensure that all data from an iteration is from a consistent table snapshot.
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
| cols | Union[str, Sequence[Str]] | The columns to read. If not given, all columns are read. The default is |
| chunk_size | int | The number of rows to read at a time. If not given, the default is 2048. |
Returns
A generator that yields a dictionary of column names to NumPy arrays.
Examples
The following example iterates over all columns in a table in chunks of two rows at a time and prints the rows.
The following example iterates over only two of three columns in a table using the default chunk size. Since the table is only eight rows long, the generator contains only one chunk.