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

# read_text

> Read text and log files as a SQL table, one row per line.

`read_text` reads UTF-8 text and log files and returns one row per line. Each row has the line's text in `content`.

## Signature

```chowder-sql theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
read_text(pattern)
```

| Parameter | Type | Description |
| - | - | - |
| `pattern` | `VARCHAR` | A text file, directory, glob, or supported remote URI. |

Supported extensions: `.txt` and `.log`.

## Example

```chowder-sql theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
SELECT
    source,
    line_number,
    content
FROM read_text('hf://buckets/chowderai/chowder-demo/text/data/amazon-reviews/*.txt')
WHERE content ILIKE '%battery%'
LIMIT 5;
```

## Columns

| Column | Type | Description |
| - | - | - |
| `source` | `VARCHAR` | Input path or URI. |
| `line_number` | `BIGINT` | One-based line number within the source file. |
| `content` | `VARCHAR` | Line text, without the line ending. |

A leading UTF-8 byte-order mark is removed. Invalid UTF-8 bytes become the replacement character (`�`) instead of failing the query. Empty lines are kept as rows with empty `content`.

## Execution

* When the query doesn't select `line_number`, Chowder reads large files in parallel chunks.
* Selecting `line_number` reads each file in order, so line numbers stay correct.
* `LIMIT` stops reading once the query has enough rows.
* Memory use stays bounded. Chowder holds one chunk plus the longest line at a time.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.