Skip to main content

Module views

Module views 

Source
Expand description

Generates DuckDB query DDL from a dump’s schema registry, and assembles it with the consumer-registered view sets carried in the dump.

convert writes one sparse-wide Parquet table (see crate::convert). The DDL here turns that flat table into an ergonomic query surface so an agent need not know the column layout:

  • a base view events every other statement builds on — the only thing bound to the Parquet path (so the rest is path-independent and can live in the dump/footer verbatim);
  • one per-event-type view (named by the event’s qualified name) selecting just that event’s rows, so SELECT * FROM "my::Event" beats filtering the wide table by hand;
  • a backbeat_keys manifest listing every promoted key/span column and which event declares it, so the joins are discoverable — an agent reads the manifest instead of guessing keys.

These Tier 1 views are generated purely from the registry — no domain knowledge. A consumer adds Tier 2 domain joins (e.g. dc’s stream_by_dump) by register_views!-ing a .sql file; those ride in the dump and are appended after Tier 1 by assemble. The whole DDL references events, so binding that one view to a Parquet (or any source) activates everything.

Functions§

assemble
Assembles the full DDL body: Tier-1 (generated) followed by each registered Tier-2 view set (verbatim, in dump order). This is the path-independent text written to the Parquet footer; the sidecar is this prefixed with bootstrap.
bootstrap
A one-line bootstrap that binds the base events view to a Parquet file, prepended to the .sql sidecar (where convert knows the output path). The footer-embedded copy omits this so it stays path-independent.
generate_tier1
Generates the Tier-1 DDL from the unioned schema registry. References a base view events (see bootstrap) but does not define it, so this text is path-independent and embeds verbatim in the dump and the Parquet footer.