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

# query_result

## Module

Query result wrapper for easy data access and pagination.

## QueryResult

A list-like wrapper for query results that provides easy access to records and pagination.

This class makes it simple to work with query results by:

* Providing list-like indexing and iteration (e.g., result\[0], for record in result)
* Flattening nested record structures into simple dictionaries
* Exposing pagination metadata (limit, next\_starting\_token, paginated)
* Offering a next\_page() method to easily fetch subsequent pages

**Examples**

```python theme={null}
# Basic iteration
log_stream = LogStream.get(name="Production Logs", project_name="My AI Project")
result = log_stream.get_spans(limit=10)

for record in result:
    print(record["id"], record["input"])

# Index access
first_record = result[0]
print(first_record["created_at"])

# Pagination (in-place - extends the current result)
if result.has_next_page:
    result.next_page()
    print(f"Now have {len(result)} records after fetching next page")

# Pagination (with assignment - same object returned)
result = log_stream.get_spans(limit=10)
if result.has_next_page:
    result = result.next_page()
    for record in result:
        print(record["id"])

# Check pagination status
print(f"Total records in this page: {len(result)}")
print(f"Has next page: {result.has_next_page}")
```

### has\_next\_page

```python theme={null}
def has_next_page(self) -> bool
```

Whether there is a next page available.

### last\_row\_id

```python theme={null}
def last_row_id(self) -> str | None
```

The ID of the last row in this result set.

### limit

```python theme={null}
def limit(self) -> int
```

The maximum number of records per page.

### next\_page

```python theme={null}
def next_page(self) -> QueryResult
```

Fetch the next page and extend current results.

**Examples**

```python theme={null}
# In-place usage (mutates the result)
result = log_stream.get_spans(limit=10)
if result.has_next_page:
    result.next_page()
    print(f"Now have {len(result)} records")

# Assignment usage (same object, supports chaining)
result = log_stream.get_spans(limit=10)
if result.has_next_page:
    result = result.next_page()
    for record in result:
        print(record["id"])
```

### next\_starting\_token

```python theme={null}
def next_starting_token(self) -> int | None
```

Token for fetching the next page, or None if this is the last page.

### paginated

```python theme={null}
def paginated(self) -> bool
```

Whether pagination is enabled.

### starting\_token

```python theme={null}
def starting_token(self) -> int
```

The starting token used for this page.

### to\_list

```python theme={null}
def to_list(self) -> list[dict[str, Any]]
```

Convert the result to a plain list of dictionaries.

**Examples**

```python theme={null}
result = log_stream.get_spans()
records_list = result.to_list()
```
