Virtual-table contract
A virtual table declares a warehouse receiver, the source relation it reads, and a closed set of pushdown shapes. The relation declares the source key, typed columns, subject, deletion signal and travel window. Every shape has a fixed parameterized statement.first bounds results and
keys bounds a list pushed across a key join. An unsupported selection
refuses PushdownMissing. An unbounded join needs a bounded driving side,
or a point lookup. Trino can serve as one receiver for a federation: its
forwards map each catalog name to { receiver, database, travel? }, the
receiver and database the catalog exposes and the connector’s cut window.
A relation declared on a forwarded receiver is rendered through its catalog,
and one reaching the federation through no forward refuses
RelationUndeclared. A forward without travel has no cut, so a table that
reads through it serves no dated read. A table’s travel is an opt-in at
most the derived window: the minimum of its relation’s travel and the
crossed forward’s. A larger value refuses TravelMissing, naming the
limiting relation or forward.
Each warehouse receiver declares its provider’s reviewed finite request-log
policy with requests: { retain, message }. The lock prints the policy for
the receiver and each crossed forward. The provider keeps request logs for
the declared duration. The credential’s scope determines who the warehouse
sees. Caller-scoped answers stay in the
caller’s own member. Every receiver also declares isolation, a reviewed
statement of what confines its credential or the reviewed "none" when
every answer lands at its one receiving label. bijection check refuses a
receiver without one, a receiver serving several members needs a statement,
and the lock prints the choice.
Request-log erasure removes the receiver’s record of a request. To review
an explicit source erase, declare upstream: { erase, lifetime } on the
virtual table. The lock records a pending target. The design sends from the
explicit eraser only, in the commit that closes the blind address and
writes the standing ban. Upstream erase contract
End-to-end upstream erase forwarding is designed, not implemented.
The refresh mutation asks the warehouse. Its private continuation validates
and lands erasable, dated facts, then closes the raw reply. A query or watch
reads the landed answer with its source observation and position. A key the
warehouse answers absent reads ready with a null value and closes nothing
derived from an earlier answer. Only the deletion signal, the lifetime or an
erase closes a key. A source deletion excludes observations at or before
the commit that applies it. A new observation after that cutoff can land
a re-created key. An explicit local erase keeps a standing ban until
audited readmission. A past
Bijection version or a branch reads its own landed answers. To read a past
source instant, request it explicitly within the declared travel window.
A travelling receiver declares skew, which the default source cut
subtracts from the refresh instant. A timeline declaration lands a
bounded valid window per key. Supply over: { from, to } to request
another window, which lands as its own answer beside the latest one.
Queries select the period in force from the covering window with the
newest source observation, the latest landing breaking a tie, and read
unasked outside every window. A key whose periods overlap is
refused alone, and the reply’s other keys land. Use
ready(ctx, value, { within }) to require a fresh value in a mutation.
The optional evict interval removes answers from the live cache while
retaining their history. The kernel enforces row and total lifetimes,
including after eviction. A relation without a deletion signal requires
a table lifetime. Totals that share a destination use one kernel lifetime.
Scaffold a source schema
Capture metadata using your warehouse’s tools. Feed the saved document tobijection schema import. Use an Iceberg struct schema for Iceberg and a
complete catalog observation containing is_complete and columns
for the other formats.
iceberg, delta, hudi, snowflake and
bigquery.
Add --virtual <receiver> for a Snowflake, BigQuery, Databricks or Trino
virtual-table scaffold. It transcribes the relation, source keys, types and
column mappings from local metadata. Fill in the marked audience, pushdown,
freshness and deletion or lifetime choices during review. Check drift
with bijection schema diff <before> <after> --check.
Work with copies and versions
A selection over a copy reads the rows the copy last published, at the reading transaction’s version, so queries, mutations and watches see one complete snapshot. Track the source position and the published snapshot separately. For bulk data, read dataset versions and hand them to compute by reference.Keep a typed copy
UsetableCopy from @bijectionhq/library-sources to give the app a typed
table. It returns a subtree: rows (the copy, keyed by key), state,
refresh and status. For Iceberg, Delta or Hudi, mount the Tables app at
the copy’s label and pass it to lakeSnapshot. The mount must have an active,
complete generation before the copy can refresh.
bijection/app.ts
orders is the reviewed scaffold. From a function running under the
copy’s label, await ctx.call(ordersCopy.refresh, {}) publishes the active
snapshot. Read a row with ctx.get(ordersCopy.rows(key)). A labelled copy is
protected. Its whole-table selection uses
.atMost(n) with an application-chosen bound.
ctx.call(ordersCopy.status, {}) gives the revision, source position,
observedAt, row count and last error.
A virtual table acquires SQL answers on demand.
Its copy: true option consents to a bounded local copy if a derived
serve plan requires a population.
Only the copy’s own functions write its table. An invalid acquisition leaves
the previous publication readable. A newer refresh supersedes an unfinished
one. The complete snapshot must fit the transaction’s storage limits, and
each row has a 24 KiB limit. The acquisition can have its own tighter
bounds. Use compute and Datasets for bulk materialization.
For an erasable copy, provision its suppressionKey before its first
refresh or erase. An erase closes the key’s retained rows and keeps a
reviewed MAC suppression, also for a key that no snapshot has landed yet.
When the copy declares upstream.erase, the erase mutation submits the
source key to that operation.