Skip to main content
POST
/
apps
/
{app_id}
/
views
/
sql
Handler for SQL CREATE MATERIALIZED VIEW statements
curl --request POST \
  --url https://api.example.com/apps/{app_id}/views/sql \
  --header 'Content-Type: application/json' \
  --data '
{
  "sql": "<string>",
  "refresh_mode": "<string>"
}
'

Path Parameters

app_id
string
required

Application ID

Body

application/json

SQL CREATE MATERIALIZED VIEW Request

sql
string
required

SQL CREATE MATERIALIZED VIEW statement Format: CREATE MATERIALIZED VIEW app::view_name AS SELECT ... FROM app::collection WHERE ... GROUP BY ... Example: "CREATE MATERIALIZED VIEW myapp::daily_summary AS SELECT market, SUM(volume) as total FROM myapp::trades GROUP BY market"

refresh_mode
string | null

Optional refresh mode: "live" (auto-refresh on write) or "lazy" (manual refresh) Defaults to "lazy"

Response

View created successfully