# Export genealogy for analytics tools

> Switch on the incremental Parquet export of the genealogy (Hive folder layout by table and date) for analytics tools, read its watermark and the as_of_seq state of each row, manage the folder's access and retention yourself (it is not encrypted and outside the purge), and check the chain links from the files.

Product: eaxScada · Type: How-to guide · Editions: Pro, Enterprise
Source: https://eaxware.com/docs/eaxscada/how-to/export-genealogy-for-analytics-tools/
Verified against commit 9d50b4d.

## Goal

Give an analytics tool (a data lake, a notebook, a reporting database) the genealogy as Parquet files that it can read directly, updated on a schedule, without querying the live server. The export is **off by default**.

## Before you start

- An Administrator, on site.
- A folder for the files. **The files are not encrypted**, even when encryption at rest is on, and **a purge does not remove them**: choose a folder whose access and retention the site manages, and decide who may read it.

## 1. Switch the export on

Open **Genealogy > Retention and purge**, section **Export for analytics tools (Parquet files by date)**:

1. Tick **Export the records**.
2. **Folder**: absolute, or relative to the genealogy data folder. Empty: `data/genealogy/hive`.
3. **Every**: how often it runs, such as `15m` or `1h`. Empty: 1 hour. At least 1 minute.
4. Choose **Save settings**. The export starts at the **next start of eaxScada**.

Below the form, **Folder in force**, **Encrypted** (always *No*), **Last run** and **Last result** (files and rows) show what the running server does.

The same settings in `data/genealogy/settings.json`:

```json
{
  "hive_export": { "enabled": true, "dir": "D:\\analytics\\genealogy", "interval": "15m" }
}
```

The file is per server and not replicated: on a high availability pair, set it the same on both servers. Only the primary writes the folder, so the export goes on after a failover.

To export once by hand, with eaxScada stopped: `eaxscada.exe genealogy export-hive --out <folder>`.

## 2. The folder layout

One folder per table, partitioned by the UTC plant date of the record that brought the row:

```text
<folder>/
  _genealogy_export.json
  events/date=2026-11-02/part-00000000000000000001-00000000000000004812.parquet
  units/date=2026-11-02/part-….parquet
  links/…
  operations/…
  results/…
```

| Table | Rows |
|---|---|
| `events` | Every record, as stored, with its chain columns (`prev_hash`, `record_hash`, `origin`, `origin_seq`) |
| `units` | Parts and lots |
| `links` | Components consumed by units |
| `operations` | Operations at stations |
| `results` | Measured values with their quality |

A file name holds the range of record numbers (`ledger_seq`, 20 digits) the run exported.

## 3. Read the watermark and the state of a row

`_genealogy_export.json` is the **watermark**:

```json
{ "ledger_seq": 4812, "last_run": "2026-11-02T08:15:20Z", "files": 7 }
```

Every record up to `ledger_seq` is in the files. Each run exports the records past the watermark, writes each file under a temporary name and renames it, then writes the watermark. If the server stops between the files and the watermark, the next run removes the files past the watermark and writes them again: no row is exported twice.

Every row carries **`as_of_seq`**, the number of the record that brought it. `events` rows never change. A link or an operation changes when a later record ends, corrects or voids it: it is exported again with that later `as_of_seq`. **The current state of a row is its row with the highest `as_of_seq`**: in your query, keep for each row id only the newest `as_of_seq`.

## 4. Pseudonymised sites

With `pseudonymise_operators` on:

- the `operator` column of `operations` is empty, and operator names are never exported;
- a record that names a person (an operator or a signer, a signature, an account as its source) is exported with its content, source and signature fields empty and **`payload_withheld` = true**.

Its chain columns stay, so the links still verify (below), but its own hash cannot be recomputed from the files. The whole record stays in eaxScada and in the purge archives.

## 5. Check the chain from the files

An outside party can check that the exported records form an unbroken chain, without access to eaxScada:

1. In `events`, group the rows by `origin` (one writer run) and sort each group by `origin_seq`.
2. In each group, every row's `prev_hash` must equal the `record_hash` of the row before it, and `origin_seq` starts at 1 and goes up by one, with no gap or repeat.
3. The first row of an origin points at the `record_hash` of the last record held when that run started, or at the genesis value `GENESIS_GENEALOGY_…` for an empty ledger.
4. Compare the chain tips with the `GENEALOGY_CHAIN_ANCHOR` records of the eaxScada audit trail (written every 15 minutes or 10,000 records): a matching tip shows the chain was not rewritten after that anchor.

**Diagram: Checking the genealogy chain from the exported files** (data flow)

The rows of the events table are grouped by origin, one writer run, and sorted by origin_seq. Within each origin, every row's prev_hash must equal the record_hash of the row before it, with no gap in origin_seq. The first row of an origin points at the last record held when that run started, or at the genesis value. The chain tips are then compared with the GENEALOGY_CHAIN_ANCHOR records of the eaxScada audit trail. Any mismatch is a break.

**Parts**

- **events** (file or document): exported rows with prev_hash, record_hash, origin, origin_seq
- **Group by origin** (service or process): sort by origin_seq
- **Each row links?** (check or decision): prev_hash = the record_hash before it, no gap in seq
- **First row of the origin** (check or decision): points at an earlier run's last record, or GENESIS
- **Tips match the anchors?** (check or decision): GENEALOGY_CHAIN_ANCHOR in the audit trail
- **Audit trail** (data store): an anchor every 15 min or 10,000 records
- **Break** (outcome): a row removed, inserted or changed
- **Unbroken** (outcome)

**Connections**

- **events → Group by origin** (data or telemetry)
- **Group by origin → Each row links?** (next step)
- **Each row links? → First row of the origin** (next step): yes
- **Each row links? → Break** (refusal): no
- **First row of the origin → Tips match the anchors?** (next step): yes
- **First row of the origin → Break** (refusal): no. A first record that points at a record no longer held means an earlier run was removed.
- **Audit trail → Tips match the anchors?** (data or telemetry): tips
- **Tips match the anchors? → Break** (refusal): no. An anchored tip that the files do not reach: the chain was cut or rewritten after that anchor.
- **Tips match the anchors? → Unbroken** (next step): yes. Each record's own hash is recomputed by Verify in eaxScada or eaxscada genealogy verify; a record withheld on a pseudonymised site keeps its links but not its content in the files.

The files prove the links between records. A tip that matches an anchor in the audit trail shows the chain was not rewritten after that anchor.

Recomputing each record's own hash, and checking the whole ledger, is done by **Verify** in eaxScada or `eaxscada genealogy verify`.

## Verify

After the first interval, **Last result** shows files and rows, and `_genealogy_export.json` holds a `ledger_seq` near the Status page's record count.

## Related

- [Part and lot genealogy](/docs/eaxscada/explanation/genealogy/)
- [Genealogy retention, purge and archives](/docs/eaxscada/how-to/genealogy-retention-purge-and-archives/)
