> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Serve dataset versions to warehouse readers

Engines that read the catalog directly (a Trino or Spark catalog connection, a
BI tool) can read a published Iceberg view instead of a lease.

## Native consumer views

Submit to the installation's `viewPublication` target to create a view in the
same catalog that selects one version's tag:

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { mutation, t } from "@bijectionhq/bijection";

export const viewPublished = mutation(
  { args: { name: t.string, result: t.result(lake.viewPublication) } },
  async (ctx, { name, result }) => {
    // result.ok: result.value is { view: { namespace, name }, number }
    // otherwise result.code is "Refused" or "Untagged"
    return null;
  },
);

export const publishView = mutation({ args: {} }, async (ctx) => {
  await ctx.submit(lake.viewPublication,
    { dataset: "orders", name: "orders_current", number: null, columns: ["id", "total"] },
    { once: "view:orders_current", within: { hours: 1 }, then: viewPublished.with({ name: "orders_current" }) });
  return null;
});
```

The view is `SELECT <columns> FROM <namespace>.<table> VERSION AS OF
'bijection-v<n>'`; `columns: null` selects every column. With `number`, the view
stays on that version; with `number: null`, the view follows the current
version and is published again on every new one. A view holds the version it
selects, so the version stays readable while the view exists. Its task settles
once the catalog created the view, or refuses `Refused`.

A synced dataset's head is a version only once tagged, and a view of an
untagged version refuses `Untagged`. Publish a view of it after submitting to
`lake.pinning`, or at the sync's publication cadence.

`views.list({ dataset })` lists views and `views.drop({ dataset, name })`
drops one; both allow `roles.operator`. Every view writes a reach record from
its publication until it leaves the version, under the principal
`view:<name>`.

Readers of a view authenticate to the catalog as themselves: what they may read
is the catalog's access control, not a Bijection lease. Publish views only of
datasets whose readers the catalog already governs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.