mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-26 12:33:59 +00:00
Remote data prewarm used REST even though SQL supported filters and concurrency, and both maintenance APIs returned after acceptance without exposing a consistent typed completion handle. Compaction's legacy statistics therefore could not describe the work committed by its durable job. This PR adds job-returning compaction and data-prewarm methods across Rust, Python sync/async and TypeScript, and moves data-prewarm submission to SQL. Legacy methods retain return-after-acceptance behavior; data prewarm now requires a compatible SQL PREWARM server and Flight SQL connectivity. This consolidates #5037, #5055 and #4906. This was accomplished with the following changes: - Added `compact_async()` / `compactAsync()` and `prewarm_data_async()` / `prewarmDataAsync()`, retaining the command receipt's durable job ID. - Added `PrewarmDataOptions` for columns, a metadata-pruning filter and concurrency; both operations inherit database, namespace and branch from the table handle. - Added filter/concurrency arguments to legacy Python `prewarm_data()` and a TypeScript `prewarmData(options)` overload, preserving the columns-array form and discarding the handle after acceptance. - Added typed `CompactionResult` and `PrewarmDataResult` decoding, including reopened jobs; missing result payloads fail explicitly and omitted measurements remain unknown. - Reused the shared Job lifecycle for status, refresh, progress callbacks, cancellation and events; Python maintenance progress bars display rewritten rows or completed executors. - Added TypeScript `wait({ timeoutMs, onProgress })` and Rust `wait_with_options(JobWaitOptions)`, complementing Python's existing timeout argument without cancelling the durable job. - Validated single unambiguous receipts, preserved compaction option presence/default inheritance, and returned actionable unsupported-server errors without dropping options or falling back to REST. - Updated native bindings, API references and maintenance documentation with job methods, result semantics, tuning and compatibility requirements. ### Usage and behaviour **New** = added here; **Enhanced** = existing support extended; **Existing** = already on main. This table describes remote SDK behavior; server-side SQL/CLI capabilities are prerequisites, not additions made by this SDK PR. | Surface | Capability | Compact | Data prewarm | Assessment | | --- | --- | --- | --- | --- | | Rust / Python sync+async / TypeScript | Submission transport | Existing SQL OPTIMIZE | **New:** REST → SQL PREWARM | Both now submit through SQL | | All SDKs | Durable job-returning API | **New:** `compact_async` / `compactAsync` | **New:** `prewarm_data_async` / `prewarmDataAsync` | Same lifecycle model | | All SDKs | Options and target scope | **New handle:** four existing compaction overrides, with omitted fields inherited | **New options:** columns/filter/concurrency | Namespace and branch preserved for both | | Python / TypeScript | Legacy convenience calls | Existing optimize acceptance behavior preserved | **Enhanced:** legacy methods accept filter/concurrency and use SQL | Return after acceptance; no completion wait | | All SDKs | Typed successful result | **New:** committed rows, file/fragment changes, partial commit and `more_work` | **New:** pinned version, fragments and executor outcomes | Different measurements are intentional | | All SDKs | Status / refresh / progress | Existing Job APIs reused by **new** maintenance handle | Existing Job APIs reused by **new** maintenance handle | HTTP monitoring remains | | Python / TypeScript | Progress presentation | **Enhanced:** rewrite rows/groups | **Enhanced:** executor progress | Shared callbacks; Python bars use operation counters | | All SDKs | Bounded wait | Python existing; **new** TS/Rust timeout controls | Same shared timeout support | Timeout stops this wait; job continues | | All SDKs | Reopen and await typed outcome | **New:** compaction result decoding on reopened handle | **New:** prewarm result decoding on reopened handle | Rust selects the typed result explicitly | | All SDKs | Cancel / events | Existing shared APIs available on **new** handle | Same | HTTP underneath; permissions unchanged | | All SDKs | Typed preview helper | Unavailable | Unavailable | General SQL where exposed; no helper added | | Authorization | Submission | Existing table Ownership plus parent Usage | SQL path uses Select plus parent Usage | Intentional difference | | All SDKs | Local / historical handles | New durable API rejects them | New durable API rejects them | Remote current-branch jobs only | ```python from datetime import timedelta # Legacy convenience call: returns None after acceptance. table.prewarm_data(["payload"], filter="id >= 1000", concurrency=4) warm = table.prewarm_data_async(["payload"], filter="id >= 1000", concurrency=4) warmed = warm.wait(timeout=timedelta(minutes=10), progress=print) print(warmed.table_version, warmed.executors_completed) compact = table.compact_async(compaction_options={"max_source_rows": 1000000}) committed = compact.wait(timeout=timedelta(minutes=10), progress=print) print(committed.rows_succeeded, committed.fragments_removed, committed.more_work) reopened_result = db.open_job(compact.id).wait() ``` ```typescript await table.prewarmData({ columns: ["payload"], filter: "id >= 1000", concurrency: 4 }); const job = await table.prewarmDataAsync({ columns: ["payload"], filter: "id >= 1000", concurrency: 4, }); const result = await job.wait({ timeoutMs: 600_000, onProgress: console.log }); ``` ```rust use std::time::Duration; use lancedb::job::JobWaitOptions; let job = table.compact_async(Default::default()).await?; let result = job.wait_with_options( JobWaitOptions::new().timeout(Duration::from_secs(600)), ).await?; ``` Python async tables await both submission and Job methods. Rust's legacy `prewarm_data(columns)` keeps its columns-only signature; use `PrewarmDataOptions` on the new job-returning method for filtering/concurrency. Wait deadlines cover pending status requests and polling delays. Existing `wait()`, TypeScript `wait(callback)` and Rust `wait_with_progress(callback)` remain supported. Status/progress/refresh/cancel/events still use generic HTTP job APIs; those endpoints and their read/event/cancel permissions must remain available. Cancelling or timing out does not roll back committed work. Compaction results describe committed rewrites and include deletion files in file counts. Prewarm results describe work against a pinned snapshot, with partial executors included in completed executors; nonempty byte/range measurements remain unknown. Missing results require compatible server/worker support rather than placeholder zero statistics. Filtering uses conservative metadata pruning, not an exact row-filter scan. ### Testing Six checked-in live Python sync/async cases pass against matching server/worker builds for compaction, job-returning prewarm and legacy filtered submission. Ten additional live Node scenarios pass for legacy/default/options forms, filters/concurrency, empty plans, validation, persisted specifications and readback. Targeted regressions pass: Python remote maintenance (80), shared jobs (82), local prewarm rejection (4); Node remote (107) and prewarm API cases (28), plus the previously exercised Rust remote regressions. Tests cover receipt parsing, typed results, reopening, unknown measurements, timeouts, and legacy calls returning None/undefined without polling. Dependency pins are unchanged. Azure account-hint acknowledgment was verified locally with filesystem storage; real Azure-backed storage still needs deployment-specific validation.
441 lines
18 KiB
Plaintext
441 lines
18 KiB
Plaintext
---
|
|
title: "Job Framework"
|
|
sidebarTitle: "Job Framework"
|
|
description: "Track background work from submission to completion."
|
|
icon: hourglass-half
|
|
keywords: ["job", "background", "progress", "events", "cancel"]
|
|
availability:
|
|
embedded: unavailable
|
|
enterprise: available
|
|
---
|
|
|
|
## Job handles {#convention}
|
|
|
|
A job handle lets you track an operation, such as an index build or a computed
|
|
column refresh. Use it to check progress, wait for completion and inspect
|
|
failures.
|
|
|
|
Methods such as Python's `create_index_async` and TypeScript's
|
|
`createIndexAsync` return job handles. In LanceDB Embedded, the work runs in your application
|
|
process; in Enterprise, it runs on server workers or through the SQL query
|
|
backend. A returned handle can represent an operation that has already finished,
|
|
so check its status before
|
|
waiting or requesting cancellation. See the operation's API reference for when
|
|
the method returns.
|
|
|
|
<CodeGroup>
|
|
```python Python icon="python"
|
|
job = tbl.create_index_async("vector", replace=True)
|
|
|
|
print(job.id)
|
|
print(job.job_type)
|
|
print(job.status())
|
|
```
|
|
</CodeGroup>
|
|
|
|
## Cached properties and live calls {#snapshots}
|
|
|
|
Python job properties describe the last observation; reading them does not
|
|
contact the server. Submission need not fetch the full registry record, so
|
|
some properties can initially be `None`.
|
|
|
|
| Surface | Contract |
|
|
| --- | --- |
|
|
| `state` | Last observed lifecycle state. It does not update on its own. |
|
|
| `job_type`, `creation_ms` | Cached job kind and creation time in epoch milliseconds. |
|
|
| `spec` | Complete, job-specific submitted specification. Read this separately from the bounded `repr(job)` display. |
|
|
| `result` | Cached, job-specific reported data; it is not necessarily the typed object returned by `wait()`. |
|
|
| `failure` | Cached `JobFailureInfo`, when the server reports a terminal failure. |
|
|
| `status()` | Live lifecycle request. For registry jobs it also caches the full record. A failed state is returned without raising a job-failure exception; request errors can still raise. |
|
|
| `refresh()` | Fetch and cache the current record without waiting for completion. |
|
|
| `events(...)` | Separate live request returning a `pyarrow.Table` of recorded events; it does not refresh the properties. |
|
|
| `wait(...)` | Poll until completion and return the operation's typed result, or raise on failure/cancellation. Refresh afterward when you need the complete final registry record. |
|
|
|
|
For example, poll a registry handle and then retrieve its final details:
|
|
|
|
```python
|
|
import time
|
|
|
|
state = job.status()
|
|
while state == "running":
|
|
print(job.state)
|
|
time.sleep(2)
|
|
state = job.status()
|
|
|
|
result = job.wait()
|
|
job.refresh()
|
|
print(result)
|
|
print(job.spec)
|
|
```
|
|
|
|
The four lifecycle strings below are the usual SDK contract; newer server
|
|
states may pass through an older client. Do not infer execution progress from
|
|
`state` alone. Structured progress methods and queue fields require matching
|
|
SDK/server support; see [refresh admission](/feature-engineering/refresh-column#admission).
|
|
|
|
## Submit and wait for a job {#waiting}
|
|
|
|
1. **Submit the operation.** Keep the returned job handle. For an Enterprise
|
|
registry job, also keep its ID if another process needs to look it up later.
|
|
2. **Check progress.** Read the current status while the operation runs.
|
|
3. **Wait for completion.** Check that the job succeeded before using its
|
|
result. If it failed or was cancelled, inspect the failure details and any
|
|
results it committed before stopping.
|
|
|
|
In Python, `job.status()` returns the current state:
|
|
|
|
| State | Meaning |
|
|
| --- | --- |
|
|
| `running` | The operation is in progress. |
|
|
| `finished` | The operation completed successfully. |
|
|
| `failed` | The operation failed. |
|
|
| `cancelled` | The operation was cancelled. |
|
|
|
|
`job.status()` checks the current state without waiting for completion.
|
|
It returns `failed` or `cancelled` for unsuccessful jobs.
|
|
|
|
Use `job.wait()` to wait for completion and raise if the job fails or is
|
|
cancelled. Python's `Job.wait()` and `AsyncJob.wait()` retry transient connection
|
|
and read errors with capped
|
|
exponential backoff within the caller's timeout. Without a timeout, retries
|
|
continue indefinitely.
|
|
|
|
If the timeout expires while disconnected, the wait raises `ConnectionError`
|
|
with the job ID and instructions to resume waiting. A timeout while connected
|
|
raises `TimeoutError`. The job may still be running; timing out does not cancel it.
|
|
|
|
<CodeGroup>
|
|
```python Python icon="python"
|
|
from datetime import timedelta
|
|
from lancedb.exceptions import JobFailedError, JobCancelledError
|
|
|
|
job = tbl.create_index_async("vector", replace=True)
|
|
job_id = job.id # Save the ID to reopen an Enterprise registry job later.
|
|
|
|
try:
|
|
result = job.wait(timeout=timedelta(minutes=10))
|
|
except JobFailedError:
|
|
print(f"job failed: {job.failure}")
|
|
except JobCancelledError:
|
|
print("job was cancelled")
|
|
except ConnectionError as exc:
|
|
print(exc) # The job may still be running on the server.
|
|
except TimeoutError:
|
|
print(f"still running: {job.status()}")
|
|
```
|
|
```typescript TypeScript
|
|
const result = await job.wait({
|
|
timeoutMs: 600_000,
|
|
onProgress: progress => console.log(progress),
|
|
});
|
|
```
|
|
```rust Rust
|
|
use std::time::Duration;
|
|
use lancedb::job::JobWaitOptions;
|
|
|
|
let result = job.wait_with_options(
|
|
JobWaitOptions::new()
|
|
.timeout(Duration::from_secs(600))
|
|
.progress(|description| println!("{}", description.progress_snapshot())),
|
|
).await?;
|
|
```
|
|
</CodeGroup>
|
|
|
|
TypeScript's `timeoutMs` and Rust's `JobWaitOptions::timeout` bound the existing
|
|
wait poller, including pending status requests and retry/polling delays.
|
|
Expiry rejects the TypeScript promise or returns Rust's `Error::Timeout`;
|
|
the operation is not cancelled. Calling `wait()` without options still waits
|
|
indefinitely. TypeScript's existing `wait(callback)` and Rust's
|
|
`wait_with_progress(callback)` remain available. A zero timeout only permits
|
|
an immediately ready result. TypeScript timeouts use nonnegative safe-integer
|
|
milliseconds; Rust uses `std::time::Duration`.
|
|
|
|
After connectivity returns, reopen an Enterprise registry job by its saved ID
|
|
and continue waiting on the existing operation:
|
|
|
|
```python
|
|
job = db.open_job(job_id)
|
|
result = job.wait(timeout=timedelta(minutes=10))
|
|
```
|
|
|
|
For SQL-backed jobs, call `wait()` again on the original handle. These jobs
|
|
cannot be reopened with `db.open_job()`; see [SQL-backed job handles](#sql-backed-job-handles).
|
|
|
|
<span id="inspecting" />
|
|
<span id="events" />
|
|
|
|
## Inspect and cancel jobs {#managing}
|
|
|
|
| Task | What to do |
|
|
| --- | --- |
|
|
| Inspect progress | Check status and refresh the handle to retrieve details. Enterprise job events can help explain ongoing work or failures. |
|
|
| Reattach from another process | Open an existing server job with its ID, such as Python's `db.open_job(job_id)`. The server must still retain the job record. |
|
|
| Diagnose a failure | Inspect failure details and relevant events. Enterprise SQL also provides `SHOW ERRORS`. |
|
|
| Request cancellation | Call the job's cancellation method. Cancellation may take time, and work already committed is not rolled back. |
|
|
|
|
Reopening a job retrieves the existing operation; it does not restart failed
|
|
work. Treat the ID as an opaque identifier and pass it unchanged to the jobs API.
|
|
|
|
<CodeGroup>
|
|
```python Python icon="python"
|
|
job = db.open_job(job_id) # raises JobNotFoundError if unknown
|
|
job.refresh() # pull the latest status from the server
|
|
print(job.status())
|
|
|
|
events = job.events(limit=100)
|
|
print(events.to_pylist())
|
|
|
|
job.cancel()
|
|
```
|
|
</CodeGroup>
|
|
|
|
List jobs on a connection, paging through the results:
|
|
|
|
<CodeGroup>
|
|
```python Python icon="python"
|
|
for info in db.list_jobs(page_limit=50):
|
|
print(info.job_id, info.job_type, info.state)
|
|
```
|
|
</CodeGroup>
|
|
|
|
`list_jobs` yields `JobInfo` summaries, newest creation time first, rather than
|
|
live `Job` handles. Open an ID to inspect its full record. `page_limit` bounds
|
|
each server request, not the total yielded items, and `page_token` resumes a
|
|
listing. It is a lazy iterator: iteration performs requests and can raise
|
|
request errors. Use `list(db.list_jobs(...))` to collect all remaining results;
|
|
there is no `.to_list()` method.
|
|
|
|
<Note>
|
|
Job filters and synchronous `Listing` indexing, slicing, and `len()` require
|
|
a Python SDK release that includes these APIs. Older SDKs expose only
|
|
`page_token` and `page_limit`; collect results with `list(...)` before indexing
|
|
or counting them. Filtering also requires a matching Enterprise server that
|
|
supports the requested filters.
|
|
</Note>
|
|
|
|
Filter jobs on the server before pagination with `table`, `state`, `job_type`
|
|
or `job_types`, and creation-time bounds. `table` names a table in
|
|
`namespace_path` (the root by default) and includes all its branches. Requests
|
|
stay scoped to the connected database. Creation times are Unix milliseconds:
|
|
`created_at_gte_millis` is inclusive and `created_at_lt_millis` is exclusive.
|
|
Choose either `job_type` or `job_types`.
|
|
|
|
The `state` filter uses registry states: `in_progress`, `succeeded`, `failed`,
|
|
`canceled`, and `timed_out`. These differ from the SDK lifecycle labels such
|
|
as `running` and `finished` returned in `JobInfo.state`.
|
|
|
|
```python
|
|
jobs = db.list_jobs(table="events", state="in_progress", page_limit=5)
|
|
first_five = jobs[:5]
|
|
for info in first_five:
|
|
print(info.job_id, info.state)
|
|
```
|
|
|
|
Synchronous indexing and slicing refer to the remaining results without
|
|
consuming them. A bounded forward slice such as `jobs[:5]` fetches only enough
|
|
pages to reach its stop. `len(jobs)` returns the remaining count by fetching
|
|
and caching every remaining result. Negative indexes and open-ended or reverse
|
|
slices also fetch and cache all remaining results. These operations can raise
|
|
request errors; later iteration drains their cache. `AsyncListing` remains an
|
|
async iterator: use `async for` to read it.
|
|
|
|
`Listing.num_page_results()` reports cached items available without another
|
|
request, including items retained by indexing, slicing, or counting.
|
|
`Listing.page_token()` reports the next request's token. Drain all cached
|
|
items before saving that token, or resuming can skip them. Resume with the same
|
|
filters, for example `db.list_jobs(table="events", state="in_progress",
|
|
page_token=saved_token, page_limit=5)`. A `None` token after the final page can
|
|
coexist with unread cached items. A resumed listing is not a transactionally
|
|
frozen view of jobs submitted in the meantime.
|
|
|
|
`events.schema` describes the Arrow response. Use `events.to_pylist()` for
|
|
Python row dictionaries. Common event columns are `event_seq` (int64), `state`
|
|
(string), `updated_at_millis` (int64), `updated_by` (string), and nullable
|
|
`emitted_from`, `emitted_by` and `claim_entity` strings. Optional uint64 work
|
|
counters such as `rows_processed` and diagnostic details depend on job type
|
|
and server version. If a `payload` column is returned, its value is a nullable
|
|
JSON string, not an already decoded Python dictionary.
|
|
Empty results retain their schema. Events are newest first and belong to the
|
|
requested job; child events are separate. An event count is not a completed-row
|
|
count, and a running job can have no terminal `result` while producing events.
|
|
|
|
For a Function refresh, `wait()` returns a `RefreshColumnResult` such as
|
|
`rows_assigned`, `rows_failed`, `rows_remaining`, `source_version` and optional
|
|
`published_version`. Other job types have different results. Do not parse the
|
|
printed representation to recover a spec, result or progress measurement.
|
|
For object-shaped registry data, `job.spec` and `job.result` are decoded Python
|
|
dictionaries: access fields with keys, such as `job.result.get("summary")`
|
|
after refreshing a successful Function job. The separate typed object from
|
|
`wait()` uses attributes, such as `result.rows_assigned`.
|
|
|
|
Event responses have [row limits](/basics/limits#jobs). An explicit limit can
|
|
request more than the default, but it does not guarantee a complete event
|
|
history.
|
|
|
|
{/*
|
|
Draft for the Functions release. Add this section before "Embedded and
|
|
Enterprise execution":
|
|
|
|
### Progress snapshots and observers
|
|
|
|
Enterprise registry handles expose a structured progress snapshot. This
|
|
includes index and refresh handles returned directly by their async submission
|
|
methods, as well as handles reopened with `open_job()`. Call `progress()` for a
|
|
point-in-time snapshot, or pass a callback to `wait()` to observe the same
|
|
server polls that drive completion. The callback receives running and terminal
|
|
observations; it does not start another polling loop. It is a synchronous
|
|
observer and is not awaited. If it throws, `wait()` logs the error and continues
|
|
waiting; callback exceptions do not reject `wait()`.
|
|
|
|
```python
|
|
def show_progress(progress):
|
|
print(
|
|
progress.get("state"),
|
|
progress.get("phase"),
|
|
progress.get("rows_computed"),
|
|
progress.get("rows_planned"),
|
|
)
|
|
|
|
job = tbl.refresh_column_async("embedding")
|
|
snapshot = job.progress()
|
|
if snapshot is not None:
|
|
show_progress(snapshot)
|
|
|
|
result = job.wait(progress=show_progress)
|
|
```
|
|
|
|
```typescript
|
|
const showProgress = (progress: lancedb.JobProgress) => {
|
|
console.log(
|
|
progress.state,
|
|
progress.phase,
|
|
progress.rows_computed,
|
|
progress.rows_planned,
|
|
);
|
|
};
|
|
|
|
const job = await tbl.refreshColumnAsync("embedding");
|
|
const snapshot = await job.progress();
|
|
if (snapshot !== null) {
|
|
showProgress(snapshot);
|
|
}
|
|
|
|
await job.wait(showProgress);
|
|
```
|
|
|
|
```rust
|
|
let job = table.refresh_column_async("embedding").await?;
|
|
if let Some(progress) = job.progress().await? {
|
|
println!(
|
|
"state={:?} rows={:?}/{:?}",
|
|
progress.get("state"),
|
|
progress.get("rows_computed"),
|
|
progress.get("rows_planned"),
|
|
);
|
|
}
|
|
|
|
let result = job
|
|
.wait_with_progress(|description| {
|
|
let progress = description.progress_snapshot();
|
|
println!(
|
|
"state={:?} rows={:?}/{:?}",
|
|
progress.get("state"),
|
|
progress.get("rows_computed"),
|
|
progress.get("rows_planned"),
|
|
);
|
|
})
|
|
.await?;
|
|
```
|
|
|
|
Job-type-specific counters are optional. A missing `rows_computed`,
|
|
`rows_planned`, or `rows_remaining` field means the server did not report that
|
|
counter; it does not mean zero, complete, or failed. Embedded handles and
|
|
SQL-backed query handles do not have registry progress records. Use their
|
|
`status()` and `wait()` APIs, and use registry progress only on handles backed
|
|
by the jobs API.
|
|
|
|
`estimated_remaining_time_millis` is a best-effort client-side estimate. It is
|
|
omitted while a job is initializing, queued, or paused, and when there is no
|
|
positive progress rate from two compatible samples.
|
|
|
|
### Inspect a slow Function worker
|
|
|
|
On a supported Enterprise server, Python's `Job.stack(worker_id)` and
|
|
`await AsyncJob.stack(worker_id)` capture Python thread stacks from a running
|
|
Function refresh worker. Rust provides `job.stack(worker_id).await?`.
|
|
TypeScript does not yet expose this method. Stack inspection requires the
|
|
system operate privilege.
|
|
|
|
Select a worker ID from the job's progress warnings or recorded events. For
|
|
example, inspect a worker named in the current no-progress or slow-split warnings:
|
|
|
|
```python
|
|
job = db.open_job(job_id)
|
|
snapshot = job.progress() or {}
|
|
warnings = snapshot.get("warnings", [])
|
|
if warnings:
|
|
evidence = job.stack(warnings[0]["worker_id"])
|
|
print(evidence["status"], evidence["omitted_sessions"])
|
|
for session in evidence["stacks"]:
|
|
print(session["status"], session["captured_at_millis"])
|
|
print(session["stack"], session["truncated"])
|
|
```
|
|
|
|
`unavailable` and `unsupported` are explicit capture statuses; missing frames
|
|
do not establish that a worker is healthy or finished. Captures are bounded and
|
|
may reuse a recent sample. They contain Python frames without source text,
|
|
locals or native frames. Local operations and SQL-backed query handles do not
|
|
support stack inspection. For a worker that already timed out, inspect the
|
|
recorded failure events for retained traceback evidence.
|
|
*/}
|
|
|
|
## Embedded and Enterprise execution {#in-process}
|
|
|
|
The following table describes LanceDB Embedded operations and registry jobs on
|
|
LanceDB Enterprise. SQL-backed job handles follow the query lifecycle
|
|
described below.
|
|
|
|
| | Embedded | Enterprise registry job |
|
|
| --- | --- | --- |
|
|
| Execution | In your application process | On server workers |
|
|
| Job identity | No server ID | A server ID for looking up the job |
|
|
| Event history | No server event history | Available through the jobs API |
|
|
| Reattaching after a client restart | No server job to reopen | Reopen by ID while the record is retained |
|
|
|
|
### SQL-backed job handles
|
|
|
|
On Enterprise, several catalog operations return a job handle backed by the
|
|
SQL query engine rather than the job registry:
|
|
|
|
| Operation | SDK methods | Behavior |
|
|
| --- | --- | --- |
|
|
| Materialized views | `create_materialized_view_async()`, `refresh_async()`, `drop_materialized_view_async()` | Synchronous variants wait on the same SQL execution. Drop removes the catalog binding immediately; physical cleanup continues in the background. |
|
|
| Functions | Registration, `drop_function_async()` | Registration waits for catalog publication before returning the immutable FunctionVersion. Drop confirms catalog removal while cleanup continues separately. |
|
|
| Secrets | Create, alter, list, describe, drop | Credential values are bound as SQL parameters, never embedded in SQL text or returned in results. `DESCRIBE SECRET` additionally exposes rotation history. |
|
|
| Views | Create, describe, list, drop | Create returns the stored definition and schema. Drop confirms catalog removal while cleanup continues separately. |
|
|
|
|
All of these report `job.job_type` as `"query"`, with `job.id` holding the
|
|
connection-scoped SQL query UUID -- use `describe_query(job.id)` to inspect
|
|
one. Unlike registry handles, they don't expose event history, can't be
|
|
reopened through `open_job()` or reattached after a client restart, and
|
|
cancellation depends on the SQL server's support for it.
|
|
|
|
### Object teardown {#teardown}
|
|
|
|
The "physical cleanup continues in the background" behavior above, for a
|
|
dropped table, view, materialized view, Secret or Function, is a job type of
|
|
its own: `drop_object` deletes the dropped object's content, then clears it
|
|
from the database's cleanup backlog. You trigger it indirectly, by dropping
|
|
one of those objects or a [namespace](/management/namespace) -- it runs as
|
|
this job rather than inline with the call. Whether a dropped table runs as
|
|
`drop_object` or as [`drop_table`](/management/table#drop), which fences the
|
|
table's directory with its own marker instead, depends on how the deployment
|
|
stores its catalog.
|
|
|
|
## Learn more {#next}
|
|
|
|
- [Incremental Indexing](/indexing/incremental-indexing): submit index work.
|
|
- [Refresh a computed column](/feature-engineering/refresh-column): populate derived values.
|
|
- [SQL job commands](/sql/ddl/job): list jobs and inspect errors.
|
|
- [SDKs](/basics/sdk): find the job API for your client.
|