API Documentation
Modifiers
POST /build_source_table
takes your schema and builds the source table
request body
{
"log_id_column": "log_id",
"partition_id": { "column_name": "sensor_id", "data_type": "TEXT" },
"value_columns": [
{ "column_name": "temperature", "data_type": "REAL" },
{ "column_name": "humidity", "data_type": "REAL" },
{ "column_name": "pressure", "data_type": "REAL" }
],
"additional_columns": [
{ "column_name": "timestamp", "data_type": "INTEGER" }
]
}
| Key | Description | Allowed Types |
|---|---|---|
| log_id_column | Name of column that holds log ID | INTEGER |
| partition_id | Name and type of partition column | INTEGER, TEXT |
| value_columns | Name and type of aggregation columns | INTEGER, REAL |
| additional_columns | Optional extra columns | INTEGER, REAL, TEXT |
POST /modify_source_table
provides mechanism to insert, update, or delete on the source table
request body
{
"sql_strings": [
"INSERT INTO source (log_id, sensor_id, temperature, humidity, pressure, timestamp) VALUES (101, 'sensor_a', 21.4, 48.0, 1013.2, 1791566400)",
"UPDATE source SET temperature = 21.9 WHERE log_id = 42",
"DELETE FROM source WHERE log_id = 17"
]
}
| Key | Description | Allowed SQL Commands |
|---|---|---|
| sql_strings | List of SQL statements | INSERT, UPDATE, DELETE |
POST /delete_source_table
deletes the source table
response body
{ "status": "pipeline deleted" }
POST /set_recovery_mode
Toggles recovery mode. While on, readers are blocked and writes are allowed
request body
{ "recovery_mode": true }
| Key | Description | Allowed Values |
|---|---|---|
| recovery_mode | Turns recovery mode on or off | true, false |
Readers
POST /query_all
runs aggregations over every row in a partition
request body
{
"partitions": ["sensor_a"],
"aggregations": [
{ "function": "FAVG", "columns": ["temperature"] },
{ "function": "MAX", "columns": ["pressure"] }
]
}
| Key | Description | Allowed Values |
|---|---|---|
| partitions | Partition IDs to query | Up to 10 |
| aggregations | Function and columns for each aggregation | Up to 10 |
| filters | Optional row filters | =, !=, >, >=, <, <=, BETWEEN, IN, LIKE, IS, IS NULL, IS NOT NULL |
response body
{
"sensor_a": {
"all": {
"favg_temperature": 21.6,
"max_pressure": 1015.8
}
}
}
POST /query_inner
First filter. Then aggregates the last (or first) n matches
request body
{
"partitions": ["sensor_a"],
"last_n": 100,
"filters": [
{ "column": "temperature", "operator": ">", "value": 20 }
],
"aggregations": [
{ "function": "FAVG", "columns": ["temperature"] },
{ "function": "MAX", "columns": ["pressure"] }
]
}
| Key | Description | Allowed Values |
|---|---|---|
| partitions | Partition IDs to query | Up to 10 |
| first_n | Number of oldest matching rows | Positive integer, or use last_n |
| last_n | Number of newest matching rows | Positive integer, or use first_n |
| aggregations | Function and columns for each aggregation | Up to 10 |
| filters | Optional row filters | =, !=, >, >=, <, <=, BETWEEN, IN, LIKE, IS, IS NULL, IS NOT NULL |
response body
{
"sensor_a": {
"last_n": {
"favg_temperature": 22.7,
"max_pressure": 1015.1
}
}
}
POST /query_outer
First select the last (or first) n rows. Then aggregates only on filter matches
request body
{
"partitions": ["sensor_a"],
"last_n": 100,
"filters": [
{ "column": "temperature", "operator": ">", "value": 20 }
],
"aggregations": [
{ "function": "FAVG", "columns": ["temperature"] },
{ "function": "MAX", "columns": ["pressure"] }
]
}
| Key | Description | Allowed Values |
|---|---|---|
| partitions | Partition IDs to query | Up to 10 |
| first_n | Number of oldest rows to take | Positive integer, or use last_n |
| last_n | Number of newest rows to take | Positive integer, or use first_n |
| aggregations | Function and columns for each aggregation | Up to 10 |
| filters | Optional row filters | =, !=, >, >=, <, <=, BETWEEN, IN, LIKE, IS, IS NULL, IS NOT NULL |
response body
{
"sensor_a": {
"last_n": {
"favg_temperature": 22.4,
"max_pressure": 1014.6
}
}
}
POST /row_hashes
Returns a hash of each row in log ID order, one page at a time
request body
{ "hash_algorithm": "md5" }
| Key | Description | Allowed Values |
|---|---|---|
| hash_algorithm | Hash function applied to each row | md5, sha, sha256 |
| continue | Optional. Send back the continue value from the previous response to get the next page | Value from previous response |
response body
{
"columns": ["log_id", "sensor_id", "temperature", "humidity", "pressure", "timestamp"],
"rows": [
{ "log_id": 1, "hash": "9e107d9d372bb6826bd81d3542a419d6" },
{ "log_id": 5, "hash": "e4d909c290d0fb1ca068ffaddf22cbd0" }
],
"continue": "eyJhZnRlciI6NX0"
}
| Key | Description |
|---|---|
| columns | Columns included in each hash, in order |
| rows | Log ID and hash for each row, in log ID order |
| continue | Value to send back for the next page. Null when there are no more rows |
GET /health
Checks that the server is up and can read the database
response body
{ "status": "ok" }