# Read a whole file as one value

Acquire / file

A variant of [Read another file format](https://meridian.online/operations/read-another-file-format).

Read each file unparsed into a single text or binary value, one row per file.

Page: <https://meridian.online/operations/read-another-file-format/read-a-whole-file-as-one-value>

## Status

Runs as a SQL step.

arcform carries it as a `sql:` step today.

## The DuckDB step

read a whole file as one text value and one binary value, a row for each file

It reads the `orders` table the proofs share. Create it first:

```sql
CREATE TABLE orders AS SELECT * FROM (VALUES
  (1,  'Alice Ng',      'north', DATE '2026-01-03', 120.00, 'widget', 'a|b',   '{"channel":"web","items":[1,2]}'),
  (2,  'alice ng',      'north', DATE '2026-01-05',  80.50, 'gadget', 'b',     '{"channel":"shop","items":[3]}'),
  (3,  'Bob  Okafor',   'south', DATE '2026-01-05', 300.00, 'widget', 'a|c',   '{"channel":"web","items":[4,5,6]}'),
  (4,  'Carla Díaz',    'east',  DATE '2026-01-09',  NULL,  'gizmo',  NULL,    '{"channel":"web","items":[]}'),
  (5,  'Bob Okafor',    'south', DATE '2026-01-12',  45.25, 'gadget', 'c',     '{"channel":"phone","items":[7]}'),
  (6,  'Dev Patel',     'west',  DATE '2026-01-12', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (7,  'Carla Diaz',    'east',  DATE '2026-01-20',  99.99, 'gizmo',  'b|c',   '{"channel":"shop","items":[10]}'),
  (8,  'Dev Patel',     'west',  DATE '2026-02-02', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (9,  'Eve Larsen',    NULL,    DATE '2026-02-03',  15.00, 'gadget', NULL,    '{"channel":"web","items":[11]}'),
  (10, 'Alice Ng',      'north', DATE '2026-02-10', 220.00, 'gizmo',  'a|b|c', '{"channel":"phone","items":[12,13]}')
) t(order_id, customer, region, order_date, amount, product, tags, meta);
```

Then run the statement:

```sql
COPY (SELECT (('x,y' || chr(10) || '1,2' || chr(10)))::BLOB) TO '<your_scratch_dir>/whole_a.txt' (FORMAT blob);
COPY (SELECT (('left' || chr(10) || chr(10) || 'right'))::BLOB) TO '<your_scratch_dir>/whole_b.txt' (FORMAT blob);
COPY orders TO '<your_scratch_dir>/whole_orders.parquet' (FORMAT parquet);
CREATE TEMP TABLE as_text AS SELECT replace(filename, '<your_scratch_dir>/', '') AS file, content, size FROM read_text('<your_scratch_dir>/whole_*.txt');
CREATE TEMP TABLE as_binary AS SELECT replace(filename, '<your_scratch_dir>/', '') AS file, content, size FROM read_blob('<your_scratch_dir>/whole_orders.parquet');
SELECT file, size FROM as_text ORDER BY file; SELECT file, size FROM as_binary;
SELECT CASE WHEN ((SELECT count(*) = 2 AND list(content ORDER BY file) = ['x,y' || chr(10) || '1,2' || chr(10), 'left' || chr(10) || chr(10) || 'right'] AND list(size ORDER BY file) = [8, 11] FROM as_text) AND (SELECT count(*) = 1 AND typeof(any_value(content)) = 'BLOB' AND any_value(content)[1:4] = 'PAR1'::BLOB AND any_value(size) = octet_length(any_value(content)) FROM as_binary)) THEN 'as expected' ELSE error('the text files were not read as one unparsed value each, or the Parquet file as one binary value') END AS verdict;
```

Replace `<your_scratch_dir>` with a directory of your own that you can write to before running the statement.

The statement writes `whole_a.txt`, `whole_b.txt` and `whole_orders.parquet` itself, in `<your_scratch_dir>`.

It needs nothing installed beyond DuckDB itself.

## What other tools call it

Meridian's classification; an independent blind rating agreed on 95.7% of 324 rows (variant, version 3).

- Azure Data Factory: [`Binary format (source)`](https://learn.microsoft.com/en-us/azure/data-factory/format-binary) (read 2026-09-27)
- Alteryx Designer: [`Blob Input`](https://help.alteryx.com/current/en/designer/tools/developer/blob-input-tool.html) (read 2026-09-27)
- DuckDB: `read_blob` (read 2026-09-27)
- DuckDB: `read_text` (read 2026-09-27)
- Apache Hop: [`Load file content in memory`](https://hop.apache.org/manual/latest/pipeline/transforms/loadfileinput.html) (read 2026-09-27)
- Pentaho Data Integration: [`Load file content in memory`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Talend: [`tFileInputRaw`](https://help.qlik.com/talend/en-US/components/8.0/raw/raw-component) (read 2026-09-27)
