Query

`The query endpoint allows users to execute SQL queries against stored event data. Field names for that can be queried are derived from the schema.

SQL Query Requirements

  • Only the events table can be queried.

  • PostgreSQL-style placeholders ($1, $2, ...) must be used for parameter substitution.

  • Field names in the events table correspond to field names that are defined in the Schema

  • Field names should be escaped using backticks (`) .

Example Queries

-- Basic select with timestamp filter
SELECT timestamp, `lr.camera_id`, amount 
FROM events 
WHERE timestamp > $1 AND timestamp < $2

-- Aggregate query
SELECT SUM(amount) 
FROM events 
WHERE timestamp > $1 AND timestamp < $2

-- Grouped aggregation
SELECT pos_id, SUM(amount) 
FROM events 
WHERE timestamp > $1 AND timestamp < $2 
GROUP BY pos_id

Example Request

Run an ad‑hoc SQL query

get
Authorizations
AuthorizationstringRequired

Format: Api-Key {API_KEY}

Path parameters
namestringRequired

Schema name

Query parameters
sqlstringRequired

SQL statement to execute

params[]string[]Optional

Repeated parameter values bound to positional placeholders in sql

Responses
chevron-right
200

Query results

application/json
get
/schema/{name}/query
200

Query results

Last updated