BREAKING CHANGE: Resource inputs use the same names at Function
registration, column/MV creation, and refresh. Use total_cpu_millis,
total_memory_bytes, and total_gpu_count for execution-wide worker
budgets, plus gpu_class and positive gpu_count for each worker. Replace
budget dictionary inputs and unprefixed aggregate limits with these
fields. Move existing refresh gpu_count caps to total_gpu_count;
gpu_count now selects devices per worker.
Each setting resolves independently: refresh > column/MV creation >
Function annotation > deployment. Creation settings also apply to
initial MV population and automatic refresh. MVs sum total budgets
across distinct pinned Function versions; per-worker GPU counts use the
largest Function default unless overridden. An unset GPU class resolves
to gpu_class="any" after inheritance; an explicit "any" overrides a
registered concrete class. Use gpu_class="default" to pin the default
pool explicitly.
```python
@function(
gpu=True, gpu_class="h100", gpu_count=2,
total_cpu_millis=8000,
total_memory_bytes=16 * 1024**3,
total_gpu_count=4,
)
def embed(text: str) -> list[float]: ...
version = db.create_function(embed)
table.add_columns(
{"embedding": version(text=col("text"))},
gpu_class="any", gpu_count=1, total_gpu_count=8,
)
table.refresh_column_async(
"embedding", gpu_class="h100", gpu_count=4, total_gpu_count=8,
)
mv = db.create_materialized_view(
"embeddings", query="SELECT embed(text) AS embedding FROM documents",
gpu_class="any", gpu_count=2, total_gpu_count=8,
)
mv.refresh(gpu_count=4, total_gpu_count=8)
```
```mermaid
flowchart TD
R["Refresh settings"] --> E["Effective settings, resolved per field"]
D["Column or MV creation settings"] --> E
F["Function settings"] --> E
C["Deployment defaults"] --> E
E --> W["GPU class and device count per worker"]
E --> T["Total CPU, memory and GPU ceilings"]
```
Pinned Function images retain their identity. Registration GPU counts
are defaults; execution overrides determine worker allocation. Admission
rejects GPU counts below an image's minimum requirement or above the
total budget. Python, Rust, SQL/REST and supported TypeScript operations
use the same resource model.
No local builds or tests, as requested; regression coverage runs in CI.
2.1 KiB
@lancedb/lancedb • Docs
@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
- table:
Table
Returns
Accessors
name
get name(): string
Returns
string
Methods
definition()
definition(): Promise<MaterializedViewDefinition>
The query that defines the view.
Returns
Promise<MaterializedViewDefinition>
refresh()
refresh(options?): Promise<RefreshMaterializedViewResult>
Recompute the view from its source.
Local refresh requires a source build with experimental-functions.
full: true forces a remote rebuild; otherwise the server chooses the
refresh mode. Local views always rebuild, and sourceVersion selects a
source version instead of the latest. Remote SQL refreshes do not support
source-version pinning. Their results leave mode, rowsWritten, and
sourceVersion absent because the SQL job adapter does not expose these metrics.
Parameters
-
options?
-
options.full?:
boolean -
options.gpuClass?:
string -
options.gpuCount?:
number -
options.sourceVersion?:
number -
options.totalCpuMillis?:
number -
options.totalGpuCount?:
number -
options.totalMemoryBytes?:
number
Returns
Promise<RefreshMaterializedViewResult>
table()
table(): Table
The view, as the table it is.