ClickHouseCatalog

The wow_catalog table of a database: the Sink appends one row per table it keeps once it created or validated them, the warehouse's metadata (system.tables, system.columns) staying the base of the analytics catalog. A ReplacingMergeTree(written_at) ordered by (database, table, fingerprint): a row of the same content replaces the one before it, a changed one is appended beside it, so several rows of one table stand side by side during a rolling upgrade, and the catalog takes the one that matches the table's columns.

writer is MATERIALIZED currentUser(): the account that inserted the row, which no insert can set, and which the catalog trusts or not (wow.analytics.catalog.trusted-writers). table_uuid is the table's system.tables.uuid when the row was written, so a table dropped and created again is not described by its predecessor's row.

With ddl=none the Sink needs only the INSERT privilege on this table; a failed write is logged and never fails the Sink's writes. The Sink, part of the data plane, only appends here: it never calls the catalog.

Properties

Link copied to clipboard

The column a wow_catalog of an earlier version lacks, which a Sink that creates its tables adds.

Link copied to clipboard

The access of an aggregate read by the default rule: its tenant, owner and space columns.

Link copied to clipboard

The access of an aggregate read by an access policy of its own: no reader but its service decides its rows.

Link copied to clipboard

The columns of wow_catalog, in order, with their ClickHouse types.

Link copied to clipboard
const val FORMAT: Int = 1

The format of its rows; raised only by an incompatible change.

Link copied to clipboard
const val TABLE: String

The table's name.

Functions

Link copied to clipboard

The digest of columns the catalog compares with the table's own: SHA-256, in lower-case hex, of each column's <name> <type>, as system.columns reads them, in order, one per line.

Link copied to clipboard
fun ddl(database: String): String

The statement that creates database's wow_catalog when it is missing.

Link copied to clipboard
fun migration(database: String): String

The statement that adds ACCESS to database's wow_catalog of an earlier version; its rows keep it empty, which a reader takes as a policy's, until their service's Sink writes them again.

Link copied to clipboard
fun rowOf(database: String, entry: CatalogEntry, uuid: String): String

The JSONEachRow row of entry of the table uuid in database; written_at and writer are the server's.