mirror of
https://github.com/lancedb/lancedb.git
synced 2026-09-03 20:18:54 +00:00
68749ecfa3
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.
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
102 lines
2.0 KiB
Markdown
102 lines
2.0 KiB
Markdown
[**@lancedb/lancedb**](../README.md) • **Docs**
|
|
|
|
***
|
|
|
|
[@lancedb/lancedb](../globals.md) / MaterializedView
|
|
|
|
# Class: MaterializedView
|
|
|
|
A handle on a materialized view: its table plus its definition.
|
|
|
|
Obtained from [Connection#createMaterializedView](Connection.md#creatematerializedview) or
|
|
[Connection#openMaterializedView](Connection.md#openmaterializedview). The view is a normal table --
|
|
queries, indexes and search all apply through [MaterializedView#table](MaterializedView.md#table)
|
|
-- whose contents are maintained by [MaterializedView#refresh](MaterializedView.md#refresh).
|
|
|
|
## Constructors
|
|
|
|
### new MaterializedView()
|
|
|
|
```ts
|
|
new MaterializedView(table): MaterializedView
|
|
```
|
|
|
|
#### Parameters
|
|
|
|
* **table**: [`Table`](Table.md)
|
|
|
|
#### Returns
|
|
|
|
[`MaterializedView`](MaterializedView.md)
|
|
|
|
## Accessors
|
|
|
|
### name
|
|
|
|
```ts
|
|
get name(): string
|
|
```
|
|
|
|
#### Returns
|
|
|
|
`string`
|
|
|
|
## Methods
|
|
|
|
### definition()
|
|
|
|
```ts
|
|
definition(): Promise<MaterializedViewDefinition>
|
|
```
|
|
|
|
The query that defines the view, read from its stored schema.
|
|
|
|
#### Returns
|
|
|
|
`Promise`<[`MaterializedViewDefinition`](../interfaces/MaterializedViewDefinition.md)>
|
|
|
|
***
|
|
|
|
### refresh()
|
|
|
|
```ts
|
|
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`](../interfaces/RefreshMaterializedViewResult.md)>
|
|
|
|
***
|
|
|
|
### table()
|
|
|
|
```ts
|
|
table(): Table
|
|
```
|
|
|
|
The view, as the table it is.
|
|
|
|
#### Returns
|
|
|
|
[`Table`](Table.md)
|