Files
lancedb/docs/src/js/classes/MaterializedView.md
T
Wyatt Alt d5fdd2674e feat(nodejs): materialized view bindings
Exposes materialized views to TypeScript: createMaterializedView,
openMaterializedView and listMaterializedViews on Connection, and a
MaterializedView handle carrying the parsed definition and
refresh({full, sourceVersion}), which returns the typed refresh result.
select accepts column names, [alias, expression] pairs, or a record of the
same; the definition reads back off the stored schema, so a reopened handle
needs no side channel. Remote connections surface the core's not-supported
error up front.

The napi crate needed the same recursion-limit raise as the core crate: the
refresh future's type graph overflows the default trait-recursion depth.
2026-08-19 08:09:49 -07:00

2.0 KiB

@lancedb/lancedbDocs


@lancedb/lancedb / MaterializedView

Class: MaterializedView

A handle on a materialized view: its table plus its definition.

Obtained from Connection#createMaterializedView or Connection#openMaterializedView. The view is a normal table -- queries, indexes and search all apply through MaterializedView#table -- whose contents are maintained by MaterializedView#refresh.

Constructors

new MaterializedView()

new MaterializedView(table): MaterializedView

Parameters

Returns

MaterializedView

Accessors

name

get name(): string

Returns

string

Methods

definition()

definition(): Promise<MaterializedViewDefinition>

The query that defines the view, read from its stored schema.

Returns

Promise<MaterializedViewDefinition>


refresh()

refresh(options?): Promise<RefreshMaterializedViewResult>

Recompute the view from its source.

The refresh is incremental when the source's changes can be reconciled into the view -- rows added, changed or removed since the last one -- and otherwise rebuilds. full forces a rebuild; sourceVersion refreshes to that source version instead of the latest.

Concurrent refreshes of one view do not duplicate its rows. Two that plan the same source rows conflict on commit, and the loser throws rather than writing them a second time.

Parameters

  • options?

  • options.full?: boolean

  • options.sourceVersion?: number

Returns

Promise<RefreshMaterializedViewResult>


table()

table(): Table

The view, as the table it is.

Returns

Table