docs: use refresh_column_async with wait on Enterprise pages

On a LanceDB Enterprise connection the blocking refresh_column always
raises NotSupported ("a remote refresh runs as a server job; use
refresh_column_async and wait on the returned handle"). Switch the
Enterprise-only examples and prose to the job form.

The quickstart Function snippet now comes from the deployment test,
which runs it against Enterprise when LANCEDB_DOCS_TEST_DEPLOYMENT=1.
The old embedded-only test could never pass: LanceDB Embedded has no
Function catalog.
This commit is contained in:
Brendan Clement
2026-11-23 19:50:20 -08:00
parent 52209f10c3
commit cb082c083a
7 changed files with 23 additions and 53 deletions
+8 -36
View File
@@ -344,10 +344,11 @@ def flatten_stats(table):
# --8<-- [end:quickstart_flatten_stats]
def test_quickstart_derived_feature(db_path_factory):
db = lancedb.connect(db_path_factory("derived_feature"))
table = create_frames(db)
def test_quickstart_derived_feature_on_a_deployment(deployment):
# Functions need LanceDB Enterprise: LanceDB Embedded has no Function catalog.
table = create_frames(deployment)
flatten_stats(table)
db = deployment.db
# --8<-- [start:quickstart_add_feature]
from lancedb import col, function
@@ -369,7 +370,8 @@ def test_quickstart_derived_feature(db_path_factory):
)
}
)
table.refresh_column("quality_score")
job = table.refresh_column_async("quality_score")
job.wait()
# --8<-- [end:quickstart_add_feature]
# --8<-- [start:quickstart_query_feature]
@@ -379,38 +381,8 @@ def test_quickstart_derived_feature(db_path_factory):
print(features)
# --8<-- [end:quickstart_query_feature]
assert quality_scores(table) == EXPECTED_QUALITY_SCORES
def test_quickstart_derived_feature_on_a_deployment(deployment):
table = create_frames(deployment)
flatten_stats(table)
from lancedb import col, function
@function
def quality_score(
motion: float, sharpness: float, exposure: float, framing: float
) -> float:
return (motion + sharpness + exposure + framing) / 4.0
version = deployment.db.create_function_async(quality_score).wait()
table.add_columns(
{
"quality_score": version(
motion=col("motion"),
sharpness=col("sharpness"),
exposure=col("exposure"),
framing=col("framing"),
)
}
)
# --8<-- [start:quickstart_add_feature_enterprise]
job = table.refresh_column_async("quality_score")
job.wait()
# --8<-- [end:quickstart_add_feature_enterprise]
assert quality_scores(table) == EXPECTED_QUALITY_SCORES
with pytest.raises(Exception):
# The blocking form raises on Enterprise, which is why the snippet uses a job.
with pytest.raises(NotImplementedError, match="refresh_column_async"):
table.refresh_column("quality_score")
+4 -1
View File
@@ -543,7 +543,10 @@ table.add_columns(
gpu_count=1,
total_gpu_count=8,
)
table.refresh_column("embedding", gpu_class="h100", gpu_count=4, total_gpu_count=8)
job = table.refresh_column_async(
"embedding", gpu_class="h100", gpu_count=4, total_gpu_count=8
)
job.wait()
db.create_materialized_view(
"embeddings", query="SELECT embed(text) AS embedding FROM documents",
+3 -2
View File
@@ -106,7 +106,8 @@ table.add_columns(
)
}
)
table.refresh_column("embedding")
job = table.refresh_column_async("embedding")
job.wait()
```
A decorated class calls `__init__` once per remote instance and `__call__`
@@ -135,7 +136,7 @@ cached in the Function's definition:
| Step | What happens |
| --- | --- |
| `add_columns` with this Function version | Every bound Secret must now exist. The column pins this exact version, not a value. |
| A refresh starts -- `refresh_column`, or a materialized view's refresh | Every bound Secret must still exist, checked before any row is computed. |
| A refresh starts: `refresh_column_async`, or a materialized view's refresh | Every bound Secret must still exist, checked before any row is computed. |
| The job captures each bound Secret's current value | LanceDB looks up the value once, when the job starts, and sets it as that environment variable for every row the job evaluates, including its retries. No other environment variable carries over. |
This is why rotating a Secret needs no new Function version and no column
+1 -1
View File
@@ -11,7 +11,7 @@ availability:
Both a [computed column](/feature-engineering/add-computed-column) and a
[materialized view](/feature-engineering/materialized-views) can refresh
themselves on a schedule instead of waiting for an explicit
`refresh_column()`, `view.refresh()`, or `REFRESH` statement. Either way,
`refresh_column_async()`, `view.refresh()`, or `REFRESH` statement. Either way,
`auto_refresh_enabled` turns it on and `auto_refresh_interval_seconds` sets
a minimum delay before the next automatic refresh is eligible -- omit the
interval to let the server decide. What that delay is measured from differs
@@ -183,7 +183,7 @@ large enough that you would rather control when the work happens.
Automatic refresh is on by default for each computed column, and takes effect
when your Enterprise deployment enables its refresh scheduler. Until then,
call [`refresh_column`](/feature-engineering/refresh-column) yourself. Pass
call [`refresh_column_async`](/feature-engineering/refresh-column#async) yourself. Pass
`auto_refresh_enabled=False` to opt a column out, or
`auto_refresh_interval_seconds` to set how often it refreshes:
+5 -9
View File
@@ -5,7 +5,7 @@ description: "Install LanceDB, create a table, and run your first vector search.
icon: rocket
---
import { PyConnect, TsConnect, RsConnect, PyConnectObjectStorage, TsConnectObjectStorage, RsConnectObjectStorage, PyConnectEnterprisePlaceholders, TsConnectEnterprisePlaceholders, RsConnectEnterprisePlaceholders } from '/snippets/connection.mdx';
import { PyQuickstartData, PyQuickstartCreateTable, PyQuickstartAddData, PyQuickstartCurateSample, PyQuickstartCurateDedupeSetup, PyQuickstartCurateDedupe, PyQuickstartCurateDedupeQuery, PyQuickstartFlattenStats, PyQuickstartAddFeature, PyQuickstartAddFeatureEnterprise, PyQuickstartMultimodalBytes, PyQuickstartTraining, TsQuickstartData, TsQuickstartCreateTable, TsQuickstartAddData, TsQuickstartVectorSearch1, TsQuickstartMultimodalBytes, RsQuickstartDefineStruct, RsQuickstartData, RsQuickstartCreateTable, RsQuickstartAddData, RsQuickstartVectorSearch1, RsQuickstartMultimodalBytes } from '/snippets/quickstart.mdx';
import { PyQuickstartData, PyQuickstartCreateTable, PyQuickstartAddData, PyQuickstartCurateSample, PyQuickstartCurateDedupeSetup, PyQuickstartCurateDedupe, PyQuickstartCurateDedupeQuery, PyQuickstartFlattenStats, PyQuickstartAddFeature, PyQuickstartMultimodalBytes, PyQuickstartTraining, TsQuickstartData, TsQuickstartCreateTable, TsQuickstartAddData, TsQuickstartVectorSearch1, TsQuickstartMultimodalBytes, RsQuickstartDefineStruct, RsQuickstartData, RsQuickstartCreateTable, RsQuickstartAddData, RsQuickstartVectorSearch1, RsQuickstartMultimodalBytes } from '/snippets/quickstart.mdx';
This quickstart walks you through creating a table, searching your data, and preparing it for training.
By default, it uses LanceDB Embedded with a local database, so no account or API key is required.
@@ -324,7 +324,9 @@ Enterprise feature. If you're using LanceDB Embedded, skip ahead to
</Info>
Register a UDF as a Function, then call it to fill a column computed from
those flattened fields. This fills every existing row once, immediately:
those flattened fields. On LanceDB Enterprise a refresh runs as a server job:
`refresh_column_async` starts it and returns a job handle, and `wait()` blocks
until every existing row is filled:
<CodeGroup>
<CodeBlock filename="Python" language="Python" icon="python">
@@ -340,13 +342,7 @@ Read it back like any other column:
</CodeBlock>
</CodeGroup>
`refresh_column` fills only rows added since the last refresh and recomputes rows whose inputs changed, leaving unchanged rows alone. Run the same refresh as a background job instead, so it doesn't block:
<CodeGroup>
<CodeBlock filename="Python" language="Python" icon="python">
{PyQuickstartAddFeatureEnterprise}
</CodeBlock>
</CodeGroup>
Run the same refresh again after adding rows. It fills only rows added since the last refresh and recomputes rows whose inputs changed, leaving unchanged rows alone. To keep working while it runs, call `wait()` later, when you need the column filled.
See [Create a Function](/curation/create-function) for UDFs that call external
models or services, and [Computed columns](/feature-engineering/add-computed-column)
+1 -3
View File
@@ -2,9 +2,7 @@
export const PyQuickstartAddData = "table.add(\n [\n {\n \"frame_id\": \"4\",\n \"video_id\": \"clip-2\",\n \"caption\": \"a gripper lowering a cup onto the table\",\n \"stats\": {\"motion\": 5, \"sharpness\": 4, \"exposure\": 4, \"framing\": 2},\n \"embedding\": [0.3, 0.9, 0.6, 0.8],\n }\n ]\n)\n";
export const PyQuickstartAddFeature = "from lancedb import col, function\n\n@function\ndef quality_score(\n motion: float, sharpness: float, exposure: float, framing: float\n) -> float:\n return (motion + sharpness + exposure + framing) / 4.0\n\nversion = db.create_function_async(quality_score).wait()\ntable.add_columns(\n {\n \"quality_score\": version(\n motion=col(\"motion\"),\n sharpness=col(\"sharpness\"),\n exposure=col(\"exposure\"),\n framing=col(\"framing\"),\n )\n }\n)\ntable.refresh_column(\"quality_score\")\n";
export const PyQuickstartAddFeatureEnterprise = "job = table.refresh_column_async(\"quality_score\")\njob.wait()\n";
export const PyQuickstartAddFeature = "from lancedb import col, function\n\n@function\ndef quality_score(\n motion: float, sharpness: float, exposure: float, framing: float\n) -> float:\n return (motion + sharpness + exposure + framing) / 4.0\n\nversion = db.create_function_async(quality_score).wait()\ntable.add_columns(\n {\n \"quality_score\": version(\n motion=col(\"motion\"),\n sharpness=col(\"sharpness\"),\n exposure=col(\"exposure\"),\n framing=col(\"framing\"),\n )\n }\n)\njob = table.refresh_column_async(\"quality_score\")\njob.wait()\n";
export const PyQuickstartCreateTable = "table = db.create_table(\"frames\", data=data, mode=\"overwrite\")\n";