Database endpoints
Refresh a materialized view
Recomputes a materialized view from its base table and replaces its stored rows.
POST /v1/tenants/{tenant}/sql/materialized-views/{name}/refresh
- Identify the stored viewSelect the view whose contents need updating.
- Re-run its source queryRecompute and replace the materialized rows.
- Check count and refresh timeInspect rows_materialized and refresh_ts.
Before you start
Use your database bearer token.
Use an existing materialized view. The example targets demo_scores; on-demand views must be refreshed when you need updated rows.
Path parameters
| Field | Type | Required |
|---|---|---|
tenant | string | Required |
name | string | Required |
Headers
| Field | Type | Required | Description |
|---|---|---|---|
x-oc-db-user | string | Optional | Acting database user (role, grant and row-policy checks). Send with x-oc-db-key. |
x-oc-db-key | string | Optional | API key of the x-oc-db-user user. |
Read the result
rows_materialized and refresh_ts describe the replacement contents. This refresh recomputes the view from its source; it does not change the view definition.
Response statuses
HTTP status reference
| Status | What to do |
|---|---|
| 200 | OK |
| 400 | Correct the request before retrying. |
| 401 | Check the credential and Authorization header. |
| 402 | Check feature access or available credits. |
| 403 | Check tenant access, roles and permissions. |
| 404 | Check the resource ID and API route. |
| 422 | Correct the values or unsupported combination. |
| 429 | Honor Retry-After when present; back off. |
| 500 | Check the outcome before retrying a write. |
| 501 | Check deployment support for this operation. |
| 502 | Check service availability and the write outcome. |
| 503 | Honor Retry-After when present; check write outcomes. |