READ_TEXT returns a table with a single content column of type TEXT NULL, where each row contains one line from the input file. Unlike READ_CSV, READ_TEXT has a fixed output schema and does not parse or split fields — each line is returned as-is.
READ_TEXT is useful for ingesting unstructured or semi-structured text data such as log files, where standard CSV parsing would fail due to delimiters or special characters in the content.
Syntax
Parameters
| Parameter | Description | Supported input types |
|---|---|---|
URL | The location of the file in an Amazon S3 bucket. The expected format is s3://{bucket_name}/{full_file_path_glob_pattern}. | TEXT |
COMPRESSION | The compression type of the input file. If not set, compression is inferred from the file extension. | TEXT |
AWS_ACCESS_KEY_ID | The AWS access key ID. | TEXT |
AWS_SECRET_ACCESS_KEY | The AWS secret access key. | TEXT |
AWS_SESSION_TOKEN | The AWS session token. | TEXT |
AWS_ROLE_ARN | The AWS role ARN. | TEXT |
AWS_ROLE_EXTERNAL_ID | The AWS role external ID. | TEXT |
- The
URLcan be passed as either the first positional parameter or a named parameter. - If you provide either
AWS_ACCESS_KEY_IDorAWS_SECRET_ACCESS_KEY, you must provide both. - Providing an AWS session token is optional.
- Credentials are not required for accessing public buckets.
- The
URLalso accepts theupload://scheme to read a file sent in the same HTTP request. See Upload and query local files.
Return type
The result is a table with a single column:| Column name | Type | Description |
|---|---|---|
content | TEXT NULL | One line from the input file. |
$source_file_name can be used to identify the source file of each row in the result set.
Examples
Example: Reading a text file The following example reads a text file and returns the first five lines:| content |
|---|
| 2026.03.19 22:30:25.150729 [ 1811245 ] <Trace> Pipe: Pipe capacity is 1.00 MiB |
| 2026.03.19 22:30:25.221936 [ 1811245 ] <Information> : Starting server … |
| 2026.03.19 22:30:25.221979 [ 1811245 ] <Information> Application: starting up |
| 2026.03.19 22:30:25.221988 [ 1811245 ] <Information> Application: OS Name = Linux |
| 2026.03.19 22:30:25.222753 [ 1811245 ] <Information> Application: Successfully used prctl |
URL can represent a single file or a glob pattern. If a glob pattern is used, all files matching the pattern are read. Use $source_file_name to identify the source file of each row:
READ_TEXT is well-suited for ingesting log files that would cause errors with READ_CSV due to delimiters or special characters. You can use string functions and regular expressions to extract structured fields from the raw text: