Query metadata¶
Each saved query is a JSON file in saved_sql/ with one entry per version ("1", "2", ...). Saving under an existing
name adds the next version; the latest version runs unless one is requested.
| Field | Type | Purpose | Example |
|---|---|---|---|
uuid |
string | Unique id of this version | "c031f3ba-8b49-4e74-adf3-b085a12581f8" |
sql_query |
string | The SQL, with optional :name parameters |
"SELECT * FROM actor WHERE actor_id = :id" |
author |
string | Who saved it | "anantha" |
description |
string | What it is for | "Look up an actor" |
tags |
string or array | Labels | ["example"] |
query_parameters |
object | Parameter definitions: a type, or an object of rules (type, required, default, enum, min, max, min_length, max_length, pattern, description) - see Parameter rules |
{"id": {"type": "int", "min": 1}} |
connection_name |
string | Optional default connection for /q/<name> |
"sakila-sqlite" |
cache_ttl |
integer | Optional response-cache lifetime in seconds - see Response caching | 60 |
created_at, last_modified_at |
string | Timestamps | "2024-03-23 23:50:57" |
status |
string | Query state | "active" |
version |
integer | Version number | 2 |
execution_history |
array | The last 50 runs of this version | see below |
An execution_history entry looks like:
{"executed_at": "2024-03-23 23:51:02", "connection_name": "sakila-sqlite", "status": "success", "rows": 1, "duration_ms": 4}
Failed runs are recorded with "status": "error" and an "error" message instead of rows and duration_ms.