> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pixeltable.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ResultCursor

> <a href="https://github.com/pixeltable/pixeltable/blob/main/pixeltable/_query.py#L264" id="viewSource" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/View%20Source%20on%20Github-blue?logo=github&labelColor=gray" alt="View Source on GitHub" style={{ display: 'inline', margin: '0px' }} noZoom /></a>

# <span style={{ 'color': 'gray' }}>class</span>  pixeltable.ResultCursor

Cursor that iterates over query results.

Wraps a Query and yields Row objects one at a time,
avoiding materializing all results into memory.

A cursor transitions through three states: pending (created but not yet started), open (actively
iterating), and closed (resources released). Iteration auto-opens and auto-closes the cursor, or you can
use it as a context manager for explicit lifecycle control.

## <span style={{ 'color': 'gray' }}>method</span>  close()

```python Signature theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
close() -> None
```

Release the underlying database transaction and query resources.

Safe to call multiple times. Once closed, the cursor cannot be reopened.
Also called automatically via the context manager protocol and on garbage collection.

## <span style={{ 'color': 'gray' }}>method</span>  open()

```python Signature theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
open() -> None
```

Start the underlying query and prepare the cursor for iteration.

Raises an error if the cursor is already open or has been closed.
Called automatically when iterating if not already open.
