MaterializedView
Data

Create a materialized view

Create a materialized view at identifier id. The view may be query-backed, UDTF-backed, or chunker-backed, controlled by the kind discriminator.

post/v1/materialized_view/{id}/create

Path parameters

idstring required

string identifier of an object in a namespace, following the Lance Namespace spec. When the value is equal to the delimiter, it represents the root namespace. For example, v1/namespace/$/list performs a ListNamespace on the root namespace.

Query parameters

delimiterstring

An optional delimiter of the string identifier, following the Lance Namespace spec. When not specified, the $ delimiter must be used.

Request body

idstring[]

View identifier path (namespace + view name)

kind'query' | 'udtf' | 'chunker' required

The materialized view kind.

  • query — plain query-backed view (no UDTF), 1:1 rows.
  • udtf — batch UDTF-backed view (N:M rows, full refresh).
  • chunker, aka 'scalar_udtf' — chunker view (1:N row expansion, incremental refresh).
source_querystring required

Opaque serialized representation of the source query that defines the view's input. The format is defined by the client; the namespace server stores it without interpreting it.

output_schemastring required

Base64-encoded Arrow schema of the view output

with_no_databoolean

If false, the server kicks off an initial refresh immediately after creating the view and the response includes a job ID.

auto_refreshboolean nullable

If true, the view is automatically refreshed when source-table data changes past the deployment-level threshold. Boolean opt-in only; the threshold and cooldown are configured on the deployment, not per-view.

Example request

{
  "auto_refresh": false,
  "source_query": "source_query",
  "identity": {
    "api_key": "api_key",
    "auth_token": "auth_token"
  },
  "kind": "query",
  "udtf_spec": {
    "num_cpus": 0.8008281904610115,
    "udtf_name": "udtf_name",
    "memory": 1,
    "partition_by_indexed_column": "partition_by_indexed_column",
    "num_gpus": 6.027456183070403,
    "kind": "udtf",
    "manifest": "manifest",
    "batch": true,
    "error_handling": "{}",
    "udtf_version": "udtf_version",
    "partition_by": "partition_by",
    "manifest_checksum": "manifest_checksum",
    "udtf": "udtf",
    "input_columns": [
      "input_columns",
      "input_columns"
    ],
    "udtf_sha": "udtf_sha"
  },
  "with_no_data": true,
  "id": [
    "id",
    "id"
  ],
  "output_schema": "output_schema"
}

Response

Materialized view created

versioninteger required

The commit version that created the materialized view

job_idstring nullable

Refresh job ID, populated only when with_no_data was false.

Example response

{
  "job_id": "job_id",
  "version": 0
}

Changes