# Read delivered data (https://docs.openetl.io/docs/next/integrate/read-data)

Use this guide when you query data that OpenETL has copied. The destination connector’s documentation defines its table, file or event format.

## Reading what OpenETL writes [#reading-what-openetl-writes]

Every row OpenETL writes to a table or a file carries metadata columns besides the source's:

| Column | What it holds |
|---|---|
| `_openetl_id` | The ID of this version of the record: a hash of the stream, the record's primary key (or, without one, every column), and its `_openetl_seq`. The same version gets the same ID however often it is read. A version read after another with the same `_openetl_seq` and other values can get an ID of its own, from its values. |
| `_openetl_op` | `insert`, `update` or `delete`. Only streams read with CDC have updates and deletes. |
| `_openetl_seq` | Where this version comes in the source's order: its position in the source's log, its cursor value, or when the read started. A later version of a record has a higher one. |
| `_openetl_synced_at` | When OpenETL wrote it, in UTC. |
| `_openetl_deleted` | `true` for a row deleted at the source. Only in streams written with merge and soft deletes, the default, which keep a deleted row rather than removing it. |

A stream whose [delivery guarantee](../get-started/concepts.md#delivery-guarantees) is at least once can hold the same version of a record twice, with the same `_openetl_id`. Keep one of each when you read it:

```sql
select *
from (
  select *, row_number() over (partition by _openetl_id order by _openetl_synced_at) as n
  from faker.purchases
) as t
where n = 1;
```

To read the latest version of each record from a stream written with append, partition by its primary key instead, and order by `_openetl_seq` descending. If two changes of a row can have the same cursor value, both versions have the same `_openetl_seq`, and can have the same `_openetl_id`. Then also order by `_openetl_synced_at` descending, and do not keep one row per `_openetl_id`. See [Choose a cursor that changes on every update](../pipelines/delivery.md#choose-a-cursor-that-changes-on-every-update).

## Names that OpenETL keeps [#names-that-openetl-keeps]

These names belong to OpenETL, in any mix of upper and lower case:

- Names that start with `_openetl`. They are the metadata columns in the table above, and any other column with such a name.
- They are also what destination connectors make beside your tables: tables, topics, collections, columns, files and object keys, such as the table `_openetl_loads` or the directory `_openetl/`. Do not change or delete them.
- In an Arrow schema, such as the schema of a Parquet file that OpenETL writes, the metadata keys that start with `openetl.`.
- In `transform.sql`, the names that start with `__openetl_`, which are the SQL engine's own. A statement cannot read a column with such a name, or give a column one with `AS` ([Reserved words](../reference/sql.md#reserved-words)). OpenETL never writes a column with such a name for a source's column.

OpenETL never gives your data a name that starts with `_openetl`:

- If a source column's name starts with `_openetl`, OpenETL writes the column without its first `_`. For example, the source column `_openetl_id` becomes the column `openetl_id`. If another column already has that name, the column gets `_2` after it. With `destination.naming: normalized`, OpenETL checks the normalized name, so a column named `-openetl` also becomes `openetl`.
- The pipeline's settings, such as `volatileColumns`, and the statements of `transform.sql` name such a column by its source name, `_openetl_id`, as they do every column. A statement that names a column `_openetl_op` with `AS` gives the output the column `openetl_op`.
- A stream in `source.streams`, a table in `destination.tables`, `destination.namespace` and a Spark or Flink transform's output cannot have such a name. `openetl apply` refuses a spec that gives one.
- The plan reports a problem for a SQL transform's output or view with such a name. It also reports a problem for a stream of the source with such a name. List `source.streams` without that stream.
- If a stream's table would get such a name once it is normalized, the plan reports a problem. Give the stream a table in `destination.tables`.

## The destination's format [#the-destinations-format]

The destination connector defines the table, file or event format and how readers see committed data. Follow that connector version's documentation for catalog setup, reader compatibility and any destination-specific metadata.
