sql-views

Embed
Preview of the card
<a href="https://lucida.15-204-158-166.sslip.io/docs/ref-sql-views"><img src="https://lucida.15-204-158-166.sslip.io/docs/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/da916cd3-c0fc-4b63-b971-b3c13623daf3/pages/399d3698-f6ab-417b-abfb-12dc3af58064/social-card.svg?v=3e7ae33eec8b" alt="sql-views" width="600" height="315"></a>
GEThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views

Parameters

project_idstringpathrequired
statusstringquery
needs_attention: failing or suspended views only

Code samples

cURL
curl -X GET "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 Page of ViewOut, by name
400
404
POSThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views

Parameters

project_idstringpathrequired

Request body

application/json
descriptionstring
materializedboolean
namestringrequired
Lowercase letters, digits and underscores, starting with a letter. Becomes the table name.
querystringrequired
One LQL SELECT.
refresh_minutesinteger
Minutes between scheduled refreshes (5 to 10080); materialized views only.
{
  "description": "string",
  "materialized": true,
  "name": "string",
  "query": "string",
  "refresh_minutes": 0
}

Code samples

cURL
curl -X POST "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views" \
  -H "Content-Type: application/json" \
  -d '{"description":"string","materialized":true,"name":"string","query":"string","refresh_minutes":0}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

201
Example
{
  "block_on_failed_checks": true,
  "consecutive_failures": 0,
  "created_at": "2024-01-01T00:00:00Z",
  "description": "string",
  "id": "string",
  "incremental_column": "string",
  "incremental_lookback_minutes": 0,
  "last_error": "string",
  "materialized": true,
  "name": "string",
  "query": "string",
  "refresh_minutes": 0,
  "refreshed_at": "2024-01-01T00:00:00Z",
  "snapshot_columns": [
    "string"
  ],
  "stored_columns": [
    [
      "string"
    ]
  ],
  "stored_rows": 0,
  "suspend_after": 0,
  "suspend_reason": "string",
  "suspended_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z",
  "depends_on": [
    "string"
  ]
}
Schema
block_on_failed_checksbooleanrequired
A refresh whose error-severity checks fail is not published (write-audit-publish).
consecutive_failuresintegerrequired
Failed refreshes in a row (P-M22); a success resets it.
created_atstringrequired
descriptionstringrequired
idstringrequired
incremental_columnstring
Column a refresh appends past (incremental view); null = full refresh every time.
incremental_lookback_minutesintegerrequired
Minutes below the watermark an incremental refresh re-reads to pick up late rows (G255); 0 = none.
last_errorstring
materializedbooleanrequired
namestringrequired
querystringrequired
refresh_minutesinteger
Minutes between scheduled refreshes of a materialized view; null = manual only.
refreshed_atstring
snapshot_columnsarray
Column names of the last snapshot.
stored_columnsarray
[[name, type], ..] of the stored version.
stored_rowsinteger
Rows of the published ClickHouse-stored version (no row cap).
suspend_afterinteger
Failures in a row that suspend the schedule; null = the server default.
suspend_reasonstring
suspended_atstring
Set when the schedule was suspended after repeated failures; resume clears it.
updated_atstringrequired
depends_onstring[]required
Tables and other views the query reads directly.
400 Bad name, schedule or query (incl. view cycles)
403
404
409
GEThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views/lineage

Parameters

project_idstringpathrequired
viewstringquery
Only this view and its transitive upstream and downstream

Code samples

cURL
curl -X GET "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views/lineage"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "edges": [
    {
      "from": "string",
      "to": "string"
    }
  ],
  "nodes": [
    {
      "downstream": [
        "string"
      ],
      "id": "string",
      "kind": "string",
      "materialized": true,
      "needs_attention": true,
      "refreshed_at": "2024-01-01T00:00:00Z",
      "upstream": [
        "string"
      ]
    }
  ]
}
Schema
edgesLineageEdge[]required
Show child parameters
fromstringrequired
Read by to.
tostringrequired
nodesLineageNode[]required
Show child parameters
downstreamstring[]required
Every view that reads this one, directly or through other views.
idstringrequired
The table or view name.
kindstringrequired
table | view | missing (a name no table or view answers to).
materializedbooleanrequired
needs_attentionbooleanrequired
The view failed its last refresh or is suspended (P-M22).
refreshed_atstring
upstreamstring[]required
Every table and view this one reads, directly or through other views.
404
GEThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views/{id}

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X GET "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views/{id}"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

404
DELETEhttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views/{id}

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X DELETE "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views/{id}"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

204
403
404
409 Other views read this one
PATCHhttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views/{id}

Parameters

project_idstringpathrequired
idstringpathrequired

Request body

application/json
block_on_failed_checksboolean
Keep the published rows when an error-severity data-quality check on this view fails against a refresh (write-audit-publish). Default true.
descriptionstring
incremental_columnstring
Column an incremental refresh appends past (rows whose value is above the last maximum); null refreshes in full again. Changing it discards the stored rows.
incremental_lookback_minutesinteger
Minutes below the watermark an incremental refresh re-reads (0 to 10080, default 0) so rows that arrive late are picked up; rows already published are skipped by content. Needs a date or time incremental column.
materializedboolean
querystring
refresh_minutesinteger
null switches the schedule off; absent leaves it.
suspend_afterinteger
Failed refreshes in a row that suspend the schedule (1 to 100); null = the server default (LC_SQL_VIEW_SUSPEND_AFTER, 3).
{
  "block_on_failed_checks": true,
  "description": "string",
  "incremental_column": "string",
  "incremental_lookback_minutes": 0,
  "materialized": true,
  "query": "string",
  "refresh_minutes": 0,
  "suspend_after": 0
}

Code samples

cURL
curl -X PATCH "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views/{id}" \
  -H "Content-Type: application/json" \
  -d '{"block_on_failed_checks":true,"description":"string","incremental_column":"string","incremental_lookback_minutes":0,"materialized":true,"query":"string","refresh_minutes":0,"suspend_after":0}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

400
403
404
GEThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views/{id}/data

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X GET "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views/{id}/data"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 The stored snapshot of a materialized view
Example
{
  "columns": [
    "string"
  ],
  "refreshed_at": "2024-01-01T00:00:00Z",
  "rows": [
    [
      {}
    ]
  ]
}
Schema
columnsstring[]required
refreshed_atstring
rowsobject[][]required
404 No such view, or it has no snapshot yet
POSThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views/{id}/refresh

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X POST "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views/{id}/refresh"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

400
403
404
422
POSThttps://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views/{id}/resume

Lift a suspension (P-M22): the failure streak resets and the view refreshes on the next tick.

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X POST "https://lucida.15-204-158-166.sslip.io/v1/projects/{project_id}/sql-views/{id}/resume"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "block_on_failed_checks": true,
  "consecutive_failures": 0,
  "created_at": "2024-01-01T00:00:00Z",
  "description": "string",
  "id": "string",
  "incremental_column": "string",
  "incremental_lookback_minutes": 0,
  "last_error": "string",
  "materialized": true,
  "name": "string",
  "query": "string",
  "refresh_minutes": 0,
  "refreshed_at": "2024-01-01T00:00:00Z",
  "snapshot_columns": [
    "string"
  ],
  "stored_columns": [
    [
      "string"
    ]
  ],
  "stored_rows": 0,
  "suspend_after": 0,
  "suspend_reason": "string",
  "suspended_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z"
}
Schema
block_on_failed_checksbooleanrequired
A refresh whose error-severity checks fail is not published (write-audit-publish).
consecutive_failuresintegerrequired
Failed refreshes in a row (P-M22); a success resets it.
created_atstringrequired
descriptionstringrequired
idstringrequired
incremental_columnstring
Column a refresh appends past (incremental view); null = full refresh every time.
incremental_lookback_minutesintegerrequired
Minutes below the watermark an incremental refresh re-reads to pick up late rows (G255); 0 = none.
last_errorstring
materializedbooleanrequired
namestringrequired
querystringrequired
refresh_minutesinteger
Minutes between scheduled refreshes of a materialized view; null = manual only.
refreshed_atstring
snapshot_columnsarray
Column names of the last snapshot.
stored_columnsarray
[[name, type], ..] of the stored version.
stored_rowsinteger
Rows of the published ClickHouse-stored version (no row cap).
suspend_afterinteger
Failures in a row that suspend the schedule; null = the server default.
suspend_reasonstring
suspended_atstring
Set when the schedule was suspended after repeated failures; resume clears it.
updated_atstringrequired
403
404

Updated