Read delivered data
Interpret record metadata, source deletes and duplicate records in destination 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
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 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:
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.
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_loadsor 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 withAS(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_idbecomes the columnopenetl_id. If another column already has that name, the column gets_2after it. Withdestination.naming: normalized, OpenETL checks the normalized name, so a column named-openetlalso becomesopenetl. - The pipeline's settings, such as
volatileColumns, and the statements oftransform.sqlname such a column by its source name,_openetl_id, as they do every column. A statement that names a column_openetl_opwithASgives the output the columnopenetl_op. - A stream in
source.streams, a table indestination.tables,destination.namespaceand a Spark or Flink transform's output cannot have such a name.openetl applyrefuses 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.streamswithout 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 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.