Changelog¶
All notable changes to this project are documented here. The format follows Keep a Changelog and the project uses Semantic Versioning.
Versioning and compatibility¶
Covered by the version number - won't change without it being called out here as a breaking change:
REST API endpoints and response shapes, CLI commands and flags, environment variables, the on-disk storage
format (a newer version can always read a database an older version wrote), the API-key/role grant fields,
the saved-query definition format, the MCP tool contract, and error codes (an existing one is never renamed or
repurposed; new ones may be added). Not covered - can change in any release,
including a patch: the admin UI's internal markup/JS structure, exact error-message or log-line wording,
and anything in queryapigate/ not re-exported from queryapigate/__init__.py (only create_app and
__version__ are public Python API).
Python versions are supported until their upstream end of life (see python.org's release status). Dropping one is a minor release, called out under Breaking - never a patch.
Experimental features are outside that promise: they may change or be removed in any minor release (a patch
release still never breaks them), and every such change is noted here. Each is marked where you meet it - a
callout in its documentation, x-experimental: true on its operations in /openapi.json, an "experimental" tag on
its rows in the Console's Settings, and a warning in the log at startup while one is in use. Today: H2 and JDBC
connections, workspaces, tracing with OpenTelemetry (OTEL_EXPORTER_OTLP_ENDPOINT), and secrets and credentials from AWS
(${aws-sm:...}, aws-rds-iam). The list is queryapigate/experimental.py.
Graduating. A feature leaves that list - and comes under the promise - when it's tested for real in CI against
what it works with; has had a security review, if it guards access or data; hasn't changed shape for a release, with
no change planned; has its known gaps closed or written down as limits; is tested on the oldest dependency versions
it allows; and its documentation says what may still be added (fields, kinds, options - never removals, which go
through deprecation). The terms are experimental.GRADUATION; connection types have their own
(databases.GRADUATION).
Still pre-1.0. Strict SemVer allows any 0.y.z release to break compatibility; this project doesn't
take that license casually. A patch release (0.10.0 -> 0.10.1) never breaks a covered surface. A minor
release (0.10.x -> 0.11.0) is this project's pre-1.0 equivalent of a major bump and may - rarely, and
always called out under its own Breaking note in that release's entry below, never left to be
discovered. Once a 1.0 ships, that same rule simply moves to major versions, as SemVer intends.
Deprecations. Something covered is deprecated only once its successor has shipped, and is announced everywhere
you could meet it: a Deprecated note in that release's entry below, a callout where its documentation describes
it, a Deprecation header (RFC 9745) and a Link: <successor>;
rel="successor-version" header on every response from a deprecated route, deprecated: true on its operation in
/openapi.json, and a warning in the log the first time it is used in a process. It keeps working, unchanged,
until it is removed: before 1.0, no sooner than the next minor release after the one that deprecated it; from 1.0,
not before the next major release. Removing it is always listed under Breaking. Two exceptions: experimental
features (above) need no deprecation period, and a security fix that can't be made compatibly may remove something
sooner, saying why. The list of what is deprecated now is queryapigate/deprecations.py.
Unreleased¶
Changed¶
- Workspaces (experimental): a signed-in user's workspace now comes from their token, not the request path. A
security review of the workspace boundary found that a federated (JWT) user's role was resolved in whatever
workspace the
/w/<workspace>/prefix named, so a user signed in for one team could reach another team's data by changing the prefix where both workspaces had a role of the same name. A signed-in user is now confined to one workspace: the newQUERYAPIGATE_JWT_WORKSPACE_CLAIMclaim names it, or the default workspace when that is unset, and a path naming a different workspace is a404, exactly as for an API key. If you relied on signed-in users addressing several workspaces by path (experimental, 0.38 only), setQUERYAPIGATE_JWT_WORKSPACE_CLAIMto a claim your tokens carry. The threat model's Workspaces section now also records the shared-JVM risk a workspace owner's H2/JDBC connection carries, and that there are no per-workspace resource limits yet.
0.39.0 - 2026-10-17¶
QueryAPIGate is now open source, under Apache-2.0. The code is unchanged.
Changed¶
- License: from the Functional Source License, Version 1.1, MIT Future License (
FSL-1.1-MIT) to the Apache License, Version 2.0 (Apache-2.0). QueryAPIGate is now open source: use, modify and redistribute it for any purpose, commercial or not, including offering it as a service. ANOTICEfile carries the copyright notice. Versions 0.7.0 through 0.38.0 were released under FSL-1.1-MIT and versions up to 0.6.1 under MIT; a copy already obtained keeps the license it came with. The code is unchanged; only the license and its metadata are (LICENSE,NOTICE, the package'sLicense-Expression, the container image label, the README).
0.38.0 - 2026-10-16¶
Workspaces (experimental): several teams on one server, each running its own connections, saved queries, keys, roles and exports - administering nothing of another's - while the platform team sees all of it. And a sign-in page for the Console.
Breaking¶
- Not a rolling upgrade. The store's primary keys change (schema 17, every name unique per workspace), so a 0.37 instance can't write to a store 0.38 has upgraded. Stop every instance before the first 0.38 one starts - the one exception before 1.x's rule that store changes are additive (Rolling upgrades). A single instance upgrades as always.
Upgrading from 0.37¶
- Stop every instance before starting 0.38 - this upgrade isn't a rolling one. The store moves to schema 17
(workspaces, ADR 0023): everything it holds goes into the workspace
default, and each name becomes unique per workspace, which changes the tables' primary keys. A 0.37 instance can't write to a store that has been upgraded, so don't run the two side by side. Back up the store, stop every instance (in Kubernetes, scale the Deployment to 0), and start one 0.38 instance - it upgrades the store - then the rest. Nothing changes for a server with one workspace, which is every server until a second is created.
Added¶
- Workspaces (experimental - ADR 0023, guide 60):
delegated administration for teams on one server. A workspace owns connections, saved queries, API keys, roles,
destinations and exports - each name unique within it - and its own run history, audit entries, alerts, events,
usage quotas and cached responses. Everything a server had is in
default, and a server with onlydefaultbehaves exactly as before. - Reaching one: every route also answers at
/w/<workspace>/.... An API key works in the workspace it was created in, with or without the prefix; naming another - or one that doesn't exist - is404 workspace_not_found, so a caller can't learn which there are. A signed-in user's role is found in the workspace the path names. - Who administers what: an administrator's role is server-wide, as before, or
null- with roles only in workspaces (/api/v1/workspaces/{name}/members). A role from a membership is that role in one workspace, without what only a server-wide one gives (administrators, settings, re-keying, erasing a person, creating workspaces); a workspace's owner manages its members and applies its configuration file. With roles only in other workspaces, an unprefixed call is403 workspace_required. /api/v1/workspaces: create, describe, remove (owners; only an empty workspace, neverdefault) - every change audited.- Seeing what happened: audit entries say their
workspace(in the hash chain;nullfor the server's own), and a member reads their workspace's; alerts and events are the workspace's own, the server's alerts for server-wide roles; in/metricsa key or connection outsidedefaultis named<workspace>/<name>. - Configuration files take an optional
workspace:and are applied there only; the CLI'sexport,exports,collection,config exportandexamplestake--workspace. - The Console: a workspace switcher once there is a second workspace, every screen in the tab's workspace, and a Workspaces screen.
- Limits, for now: a local-folder destination only in
default; no per-workspace limits; identity-provider groups aren't mapped to memberships. - A sign-in page for the Console. On a server that needs credentials, a tab without them sees only the sign-in
page - Sign in with SSO when it's set up, and a field for an admin token or API key - instead of the whole
Console with every screen failing. A refused token, or an SSO sign-in the server refused, is said there. Sign out
in the sidebar ends a token's sign-in and comes back to it. A server open to all (no
QUERYAPIGATE_API_KEY), and a key that isn't an administrator's, see the Console as before. The server decides as it always did; this changes only what a signed-out tab is shown.
0.37.0 - 2026-10-16¶
MongoDB graduates to tier 1, under the compatibility promise: a find() now streams its whole result - over HTTP, from
queryapigate export and in saved exports - in NDJSON, CSV, TSV and Parquet, the one essential feature it lacked.
Upgrading from 0.36¶
- Nothing to change. No schema change, no setting. A server with a MongoDB connection no longer logs that it's experimental; H2 and JDBC connections still do.
Added¶
- MongoDB streams (ADR 0022):
?stream=trueon a savedmongoquery and onPOST /execute_mongo,queryapigate export, and saved exports to a bucket or a folder - in NDJSON, CSV, TSV and Parquet, with the same time limit, row limits, concurrency slot, history and grants as a SQL stream. Documents don't share a schema, so each format decides what that means: NDJSON writes each document whole; Parquet, and anything written to a destination, makes every field of every document a column; a streamed CSV or TSV takes its columns from the projection, in its order, or else from the first 1,000 documents - a field first seen later is left out, and the run's history counts them (fields_dropped). Exporting amongoquery incrementally is refused, for now; full exports work.
Changed¶
- MongoDB graduates to tier 1 - under the compatibility promise, its entry gone from
experimental.py(MongoDB connections). It meetsdatabases.GRADUATION: tested against MongoDB 8.0 in CI and atpymongo4.0, its 0.34 security review's findings fixed and held by fuzzing, the time limit andallowed_tablesworking, and now streaming exports. The support matrix says always (find() only) for its read-only default. Its documentation says what may still be added (aggregation pipelines, writes, response caching, masking, incremental exports) and its limits. H2 and JDBC stay experimental.
Fixed¶
- A client that leaves a stream closes the database cursor at once, not when the response is garbage-collected: the rows' close() closed the wrapper reading them but not the database's own generator - so a MongoDB cursor stayed open on the server, and a pooled connection checked out, a little longer than the request.
Removed¶
- The
stream_unsupportederror code, which only a streamed MongoDB query answered with.
0.36.0 - 2026-10-16¶
A role for customer-facing APIs: its signed-in users run only saved queries that bind their own token, so a query
granted to it without a from_claim parameter can't show every customer every row. And image builds no longer depend
on one CDN for the H2 driver.
Upgrading from 0.35¶
- Nothing to change. No schema change, no setting. Roles you have work as they did:
require_claim_bindingis off unless you turn it on - through the API, a configuration file, or the switch in the Console's role form. - MongoDB stays experimental a release longer than 0.35 said: it graduates in 0.37, with streaming exports.
Added¶
require_claim_bindingon a role, for customer-facing APIs (Signed-in users). Afrom_claimparameter limits a query to the signed-in user's own rows - but only that query: another granted to the same role without one showed every user every row it returned, and nothing said so. With"require_claim_binding": true, a role's users run only saved queries that take a parameter from their token (anything else is403 claim_binding_required, and left out of their/catalog,/openapi.jsonand MCP tools), reach queries by name or collection only - no connection, so no ad-hoc SQL or schema browsing - and the role refuses a connection grant. A role's alone: a key created from it doesn't take it. Off by default; through the API and configuration files.
Fixed¶
- Building the image could fail on Maven Central. The H2 driver was fetched from repo1.maven.org alone, which twice answered GitHub's runners with something other than the jar - the pinned hash refused it, and the build stopped. The image now fetches it with the same script the release uses, trying Maven Central, Apache's mirror and Google's, a few times each; the hash still decides, so a mirror can't change what's installed. A wrong answer is reported - its status, type, size and first bytes - rather than only its hash.
0.35.1 - 2026-10-15¶
Two security fixes anyone running allowed_tables or ad-hoc SQL should take: a CTE named after a table read past a
key's table allow-list, and one statement could hold a worker for over a minute. Found by a review, CodeQL and the new
fuzzing - which arrive in this release too, with build provenance for the Python packages and a GitHub Release for
every version.
Upgrading from 0.35.0¶
- Nothing to change. No schema change, no setting. Two things look different: the plain-text log writes a line
break inside a message as
\n(one event, one line), and a key whose stored expiry can't be read is refused - only a store edited by hand could hold one. - From a source checkout, fetch the H2 driver before using an
h2connection:python .github/scripts/fetch_h2_jar.py. The wheel and the images bundle it as before.
Added¶
- Build provenance for the sdist and wheel: the release workflow attests what it uploads to PyPI with GitHub's
build provenance, signed through Sigstore -
gh attestation verify <file> --owner AnanthaRajuC. With the images' and the chart's, every release artifact meets SLSA Build Level 2; SECURITY.md says so, and why not Level 3. - OpenSSF Scorecard, run on every push to
mainand weekly, its results published (the README's badge) and in the repository's code scanning alerts. - A GitHub Release for every version, its notes the changelog's section, carrying the sdist, the wheel and their
build provenance (
queryapigate-<version>.intoto.jsonl) - made once PyPI has accepted them. - CodeQL on the server's Python, the Console's TypeScript and the workflows, on every push and pull request.
- Fuzzing with ClusterFuzzLite: Atheris targets for the SQL guard, table checks, MongoDB documents and parameter
rules (
fuzz/), each checking a property - no server-side JavaScript survives into what MongoDB is sent, a declared parameter is never bound to a document - not only that nothing crashes. Five minutes on every pull request, longer onmainand weekly.
Changed¶
- Every workflow gives its jobs a read-only token unless a job asks for more, as
docs.ymlalready did. - The H2 driver isn't committed any more. The wheel and the image still bundle it: each build fetches
h2-2.2.224.jarfrom Maven Central and refuses it unless its SHA-256 is the pinned one. In a source checkout, runpython .github/scripts/fetch_h2_jar.pybefore using anh2connection - without it, one says so (driver_missing) rather than failing inside Java.
Security¶
- One request could hold a worker for over a minute (found by CodeQL). Before checking a statement, the SQL guard stripped trailing whitespace and semicolons with a regular expression that took quadratic time on a long run of whitespace anywhere in it: 200,000 spaces in ad-hoc SQL - any key allowed to send some - took 81 seconds of CPU. It's a linear scan now: 9 ms for the same statement.
- A line break in a caller's SQL, or
%0Ain a request path, could forge a line of the plain-text log (CodeQL). A message's line breaks are written as\nnow, and its backslashes as\\, so one event is one line; JSON logs (QUERYAPIGATE_JSON_LOGS) were never affected. Multi-line SQL reads as one line in the plain-text log. /console/told anyone whether a file existed on the server (CodeQL). Its check before serving a file looked outside the build:/console/%2e%2e/...naming a file that existed answered 404, one that didn't the Console's page. Nothing outside was ever served. Only paths inside the build are looked at now.allowed_tablescould be read past with a CTE named after the table (found by review). Every table sharing a name with a CTE was dropped from the check, the one the CTE itself reads included:WITH secret AS (SELECT * FROM secret) SELECT * FROM secretnamed no table, so a key allowed onlyordersreadsecret- and so did a CTE read before it was defined, a schema-qualifiedpublic.secret, and the same inside a subquery. A name is a CTE's only where SQL makes it one now: after itsWITH, in the CTEs after it, and in its own body underWITH RECURSIVE. Affects every release withallowed_tables(0.11.0 on). To check whether it happened: ad-hoc runs by keys withallowed_tables, in run history, whose SQL has aWITH.- An API key or admin token whose stored expiry couldn't be read never expired. Every way in validates it, so only a store edited by hand or damaged had one; such an expiry now counts as passed.
- The SIEM stream's TLS says its minimum, 1.2, rather than leaving it to the default.
- An audit entry that couldn't be written is logged as an error. The action it recorded still stands, as before - but with the reason, rather than nothing.
Fixed¶
EXPLAIN EXPLAIN ...was looked into once perEXPLAIN- found by the new fuzzing. Each level re-scanned the whole statement, so a few thousand of them in one request cost quadratic time and ended in aRecursionError(a 500). No database runs a nestedEXPLAIN: it's refused as a write now (read_only), and nothing deeper is read.
0.35.0 - 2026-10-14¶
MongoDB is tested on every push against a real server, as every other connection type already was - and every database's tests now fail CI if they skip. A person forgotten while usage counts were being written no longer keeps a period of them.
Upgrading from 0.34¶
- Nothing to change. No schema change, no setting. MongoDB stays experimental: it graduates in 0.36, with streaming exports.
Added¶
- CI tests MongoDB against a real server - MongoDB 8.0 in the integration job:
find()with filter, projection, sort and pages; a saved query's typed parameter; the time limit cancelling a find;allowed_tablesas collections; and 0.34.2's refusals - server-side JavaScript and injected operators - sent to a real server. And atpymongo's floor, 4.0, in the oldest-dependencies job. The support matrix now says MongoDB is tested in CI.
Changed¶
- The integration job fails if a database's tests skip for want of their server, as the services step already
did: a missing
QUERYAPIGATE_IT_*would otherwise have passed it quietly.
Fixed¶
- Forgetting a person could leave a usage period behind (0.29.0 to 0.34.2). If
queryapigate history forgetorDELETE /api/v1/history?caller=ran while the background writer was storing usage counts, the counts it was writing were in neither placeforgetlooked: it missed them, and the writer stored them after the person was forgotten - a period of their usage counts kept, and left out of the countforgetreported. Forgetting now waits for a write in flight, then deletes what it wrote. Runs and events were never affected. Found by CI, as a test that failed one run in many.
0.34.2 - 2026-10-13¶
Security¶
- A MongoDB parameter's value could be query operators (0.9.0 to 0.34.1). A
:nameplaceholder took whatever JSON was sent: for a savedmongoquery whose placeholder wasn't declared with a type,{"params": {"u": {"$ne": null}}}turned{"name": ":u"}into a filter that matched every document - any caller of that query read the whole collection. Through/execute_mongo'sparams, an object could carry$function, past the check that keeps server-side JavaScript out of the filter. A value is now a string, number, boolean, null or a list of those; a document is refused withparam_invalid. Placeholders declared with a type were never affected. To check whether it happened: history keeps parameter names, never values, so look at therowsof each run of a savedmongoquery with an undeclared placeholder - a run that returned far more than that query usually does. - Server-side JavaScript in a MongoDB projection or sort (0.9.0 to 0.34.1).
$where,$functionand$accumulatorwere refused in a filter, but not inprojectionorsort, and MongoDB 4.4+ evaluates{"x": {"$function": ...}}in a projection: any key with a MongoDB connection could run JavaScript on the database server through/execute_mongo. They are refused there too, and when a savedmongoquery is saved.
0.34.1 - 2026-10-13¶
Security¶
allowed_tableswasn't checked on MongoDB connections (0.11.0 to 0.34.0). A key narrowed to some tables read every collection of amongoconnection it was granted - through/execute_mongo, and through any savedmongoquery it could run - though the documentation said such a key was refused there. On MongoDB the list is now the collections a key mayfind()in: one outside it is refused with403 table_not_allowedbefore the server is asked anything. Keys withoutallowed_tables, and every SQL connection, were never affected. To check whether it happened:GET /api/v1/history?key=<name>&kind=adhocfor each key withallowed_tablesand amongoconnection - each ad-hoc run names itsmongo_collection- and the savedmongoqueries that key could run.
0.34.0 - 2026-10-13¶
Live events, and secrets from files and Vault, are stable: under the compatibility promise, each after a security review (ADR 0021). The reviews found three things, fixed here. AWS's secrets and credentials stay experimental until they're tested against AWS.
Upgrading from 0.33¶
psycopg2-binary2.9.5 or later (was 2.9): 2.9.0 has no wheel for Python 3.11, the oldest supported, so the old floor was never one anybody could install from a wheel. CI now tests 2.9.5, on a PostgreSQL store.- If a script reads why a secret was unavailable from
error, readdetail(below). Thecodeand status are unchanged. - A
${file:...}naming one of the server's own secret files is refused (below). Nothing documented ever pointed one there; Settings lists which of the server's settings came from files.
Changed¶
- Live events are stable (ADR 0021), with the 0.33
payload unchanged. Event types, payload fields, filters and settings may still be added; ids, the fields documented
and what each filter means stay as they are. Their limits are in the documentation. They're no longer marked
experimental in Settings,
/openapi.json(GET /events) or the startup log, of either server. - Secrets from files and Vault are stable -
${VAR},${file:...},${vault:...}andvault-databasecredentials, tested on every push against Vault 1.21. Providers, credential sources, sign-in methods and settings may still be added. AWS stays experimental:${aws-sm:...}andaws-rds-iam, documented under their own heading, Secrets and credentials from AWS, and the startup warning now names only theQUERYAPIGATE_AWS_*settings. secret_unavailable(503) says only that a secret is unavailable. Why - the reference and the provider's answer, a Vault address or path among them - is in the log and in the error'sdetail, which a scoped key calling a saved query doesn't get, as with a database's own error text.- The oldest-dependencies CI job runs the suite on a PostgreSQL store too, with
psycopg2-binary2.9.5.
Security¶
- A new key with a deleted key's name saw the old key's runs. The event log kept them under the name, so the new
key could resume from
Last-Event-ID: 0and read its predecessor's runs of the lastQUERYAPIGATE_EVENTS_RETENTION_HOURS. A key now sees no event from before it was created. - A
${file:...}could read the server's own secrets where they were files inside an allowed folder -QUERYAPIGATE_SECRET_KEY_FILE=/run/secrets/fernetbesideQUERYAPIGATE_SECRET_FILE_DIRS=/run/secrets- and so an administrator could have the server's key sent to a host of theirs as a password. A file named by any of the server's own settings or the credentials it runs with, the Kubernetes and EKS service account tokens, and/procare never readable now, whatever the allow-list says. secret_unavailabletold any caller where the secrets live - the file path, Vault's address, its path and its answer - a partner's scoped key and MCP clients included. Now onlydetailsays, and only to those who'd get a database's own error text.
0.33.0 - 2026-10-13¶
Live events get a log of their own (ADR 0020). Until now an event was a row of run history, so history's settings decided which runs became events and how far back a client could resume. Now every run is written to the event log in the same batch as its history row, and kept for a set time. The payload says what happened and where it came from, ready for event types other than a run.
Upgrading from 0.32¶
- Schema 16, applied on first start: a new
eventstable. The upgrade copies the runs still in history from the lastQUERYAPIGATE_EVENTS_RETENTION_HOURS(24 by default) into it, each under its history row id, which was its event id. New event ids continue above every one the old server could have sent. A client resuming with an id from before the upgrade gets what it missed, and nothing twice. - If you read live events, update your client for the new payload (below). Live events are experimental, so this needs no deprecation period.
- Rolling upgrades: replace
queryapigate eventswith the instances. An instance still on 0.32 writes its runs to history only, so they aren't events until it's upgraded.
Added¶
- The event log (ADR 0020):
queryapigate eventsstreams the neweventstable, not run history. Every run is an event, including oneQUERYAPIGATE_HISTORY_SAMPLE_RATEsamples out of history, and one whose saved query was deleted before its batch was written. Ids are never handed out twice: on SQLite, an id could be reused when the newest run was deleted before the next was recorded. QUERYAPIGATE_EVENTS_RETENTION_HOURS(default 24): how long the event log keeps an event, and so how far back a client can resume. History's limit, retention and sample rate no longer decide it.- Subscription filters on both
/eventsendpoints:?type=,?kind=(savedoradhoc),?query=,?connection=and?status=(successorerror), combined with AND. They narrow what a key may see, never widen it, and a resume applies them too. Akindorstatusthat can never match is refused with400 invalid_filter. GET /metricsonqueryapigate events, behindQUERYAPIGATE_METRICS_TOKENlike the main server's:queryapigate_events_streams,_delivered_total,_replayed_total,_slow_disconnects_totalandqueryapigate_events_lag_seconds, from when an event happened to its delivery.
Changed¶
- The live event payload (experimental) (ADR 0020 §5): every run is
"type": "query.run", withsource(the front door:rest,mcp,export),occurred_at, andkind,queryandversionasGET /api/v1/historynames them."type": "execution","type": "adhoc_execution"andfilenameare gone: checkkindinstead, and readqueryinstead offilename.connection_nameandentryare unchanged. The Console's Home is updated to match. queryapigate history forgetandDELETE /api/v1/history?caller=erase the caller's events too, and report how many asevents.- Live events stay experimental for this release, as ADR 0017 asks of a payload that has just changed. They graduate in the next release if the payload stays unchanged.
Fixed¶
- A resume more than 1,000 events back lost the rest.
queryapigate eventsreplayed the first 1,000 events afterLast-Event-ID, then skipped to live without a word. It now replays every page up to the live stream. A client too slow to take it is disconnected as too slow, and resumes from where it got to.
0.32.0 - 2026-10-13¶
The audit log's stream to a SIEM, tested on every push against the software that receives it - rsyslog, syslog-ng and an OpenTelemetry Collector - and under the compatibility promise. And a SIEM's own copy of the log is something you can check on its own: the same command that checks the store.
Upgrading from 0.31¶
- Nothing to change. No schema change, no setting; the stream's messages are exactly as before.
Added¶
- CI tests the SIEM stream against real receivers (ADR 0019):
rsyslog 8.2604 and syslog-ng 4.12.0 taking RFC 5425 syslog over mutual TLS, and an OpenTelemetry Collector 0.160.0
taking OTLP/HTTP logs, each pinned by digest -
tests/test_audit_siem.pyreads what each one parsed and wrote: every entry, in order, as meant; a missing client certificate, and one from another CA, refused and noticed with nothing lost; an outage - the receiver stopped with a connection still open - survived; and the receiver's copy verified byaudit verify --file, an edit in it found..github/scripts/siem_receivers.shstarts the three, for CI or for you. - Guide 53 re-run against rsyslog and the OpenTelemetry Collector: Send the audit log to your SIEM, and prove nobody edited it - a refused client certificate, an outage with OTLP keeping up, and the SIEM's copy verified.
Changed¶
- The audit log streamed to a SIEM is stable (ADR 0019),
under the compatibility promise: it met the last of
experimental.GRADUATION, a real receiver in CI. Its documentation says what may still be added and its limits; it's no longer marked experimental in Settings,/openapi.json(GET /api/v1/audit/delivery) or the startup log. The OTLP records' attributes are documented in full -queryapigate.audit.prev_hashwas sent and not listed. queryapigate audit verify --filechecks what your SIEM received (ADR 0019): syslog lines as a receiver writes them, as well as JSON lines; an entry repeated - delivery to a SIEM is at least once - is dropped when it's an exact repeat, and counted; entries are checked inseqorder, however they arrived. A repeat that differs from the first copy is reported,conflicting_copies, with the two lines. A SIEM's copy of an untouched log used to fail without_of_orderas soon as it held one repeat.
0.31.0 - 2026-10-13¶
The first signed release: the image and the Helm chart, signed keyless by this repository's release workflow, with provenance naming the commit and an SBOM of what's inside - and checked before they're published, in the two forms cosign and today's admission controllers read. What a release is built from is pinned: base images by digest, every GitHub Action by commit.
Upgrading from 0.30¶
- Nothing to change. No schema change, no setting. To run only signed releases from here on, see guide 59; 0.30 and earlier aren't signed, so a policy that requires a signature refuses them.
Added¶
- Signed releases (ADR 0018): each image variant and the Helm chart
are signed keyless with cosign, by digest - the certificate names this repository's
docker.ymlat the release's tag - in both forms verifiers read: the Sigstore bundle (cosign v3,gh attestation) and the classic.sigtag that admission controllers such as Sigstore's policy-controller still need. With SLSA provenance and an SPDX SBOM on each image, and a GitHub attestation for each; the workflow verifies them before it ends, so a release that doesn't verify fails.Publish Docker imagerun by hand withrehearsedoes all of it under-rehearsalnames, never the real ones. image.digestin the Helm chart: the digest you verified, so the image is pulled by it.- Guide 59, Verify a release before you run it:
cosign verify, the GitHub attestation, the provenance and the SBOM - and a kind cluster with Sigstore's policy-controller 0.13.1, then Kyverno 1.19.1, admitting the signed image and refusing an unsigned one, all run against the release workflow's rehearsal. SECURITY.md has the two commands, for a release.
Changed¶
- What a release is built from is pinned (ADR 0018): every GitHub
Action by commit SHA - the PyPI publishing one followed a branch,
release/v1- and the image's base images,python:3.12-slimandnode:22-slim, by digest. Dependabot proposes each update as a commit; a test fails on an action or a base image that isn't pinned.
0.30.0 - 2026-10-13¶
Eight features come under the compatibility promise - descriptions, agent usage, usage quotas, configuration as code,
OAuth for the MCP server, Console sign-in through SSO, write tools over MCP and the Helm chart - each after a
security review, tested on the oldest dependency versions it allows, its limits written down
(ADR 0017). The reviews closed three ways a server let out
what it shouldn't: its own cloud credentials through a ${VAR} reference, /metrics through the chart's ingress, and
words of anyone's choosing in the Console's sign-in banner.
Security¶
- A
${VAR}reference could name the server's own cloud credentials. Only itsQUERYAPIGATE_*andOTEL_*settings were refused, so an administrator who may change connections - or the author of a configuration file - could save one whose password was${AWS_SECRET_ACCESS_KEY}and whose host was theirs, and receive the server's AWS identity: more than every allow-list of 0.28 opens. NowAWS_*,AZURE_*,ARM_*,GOOGLE_*,GCP_*,VAULT_*andKUBERNETES_*are refused too, when saved and when used; andQUERYAPIGATE_SECRET_ENV_VARS(names, or prefixes ending in*) limits${VAR}to what it lists, like the other references' allow-lists. Unset, any other variable may still be referenced - the server warns at startup while references are in use - so nothing breaks on upgrade unless a connection used one of those names. Found in the security review for 0.30 (ADR 0017). - The Helm chart published
/metricsthrough its ingress. The ingress routes every path to the API server, and/metricswas open, with API keys', queries' and connections' names in its labels - and each administrator's own name, often their username. NowQUERYAPIGATE_METRICS_TOKEN(at least 16 characters) makes/metrics- the API server's and the MCP server's - answer onlyAuthorization: Bearer <the token>, and an administrator who may observe (the Console's Metrics screen); unset, it stays open, for setups no one outside reaches. The chart sets one (metricsAuth, on by default): made in a Secret of its own, kept across upgrades, and sent by its ServiceMonitor. And administrators are counted under oneadminlabel, as signed-in users are underjwt, so no person's name is a label anywhere. Found in the security review for 0.30. - The Console showed what a sign-in link said. A refused sign-in through SSO came back to the Console as
?sso_error=...&sso_message=..., and the Console showedsso_messageas written - so anyone could send an administrator a Console link whose error banner said what they liked. Now only the code travels, and the Console says what each one means in its own words; the reason stays in the audit log. Found in the security review for 0.30.
Upgrading from 0.29¶
- On the Helm chart,
/metricsneeds a token (metricsAuth, on by default). The ServiceMonitor sends it; any other scraper reads it from the<release>-metricsSecret. Rendered without the cluster (helm template, Argo CD), setmetricsAuth.existingSecretto a Secret of yours - the chart can't see the one it made, and would make another.metricsAuth.enabled: falsekeeps/metricsopen, as before. - In
/metrics, administrators arekey="admin"- each one used to be under their own name. A dashboard that split by administrator: the audit log says which one did what. - No schema change.
Added¶
- Guide 58, Keep the server's own secrets, and its metrics, in:
QUERYAPIGATE_SECRET_ENV_VARSandQUERYAPIGATE_METRICS_TOKENon a running server, with Prometheus 3.15 scraping it - and refused without the token. - Higher minimum versions: Flask 3.0 (was 2.2), Werkzeug 3.0 (now listed: QueryAPIGate imports it), PyYAML 6.0.1
(was 6.0), and for the
mcpextra, mcp 1.21.1 (was 1.10). None of the old minimums could actually be used: Flask 2.x can't be imported beside the Werkzeug 3 that pip installs with it, PyYAML 6.0 can't be installed on Python 3.12 or later, and mcp before 1.21.1 can't be imported beside the pydantic pip installs with it.
Changed¶
- Stable now, under the compatibility promise: descriptions, agent usage, usage quotas, configuration as code,
OAuth for the MCP server, Console sign-in through SSO, write tools over MCP, and the Helm chart's values
(ADR 0017). Each met every one of
experimental.GRADUATION, and each one's documentation now says what may still be added and its limits. No longer marked experimental in/openapi.json, Settings, the Console's Agents and Approvals screens and quota fields, the chart'sChart.yamland notes, or the startup log. Usage quotas' documentation now says what doesn't count - exports, live events, MCP resources, the Management API - and that an agent's write request does. config diffandconfig apply --serverare tested against a realqueryapigate serve, over HTTP.- OpenAPI no longer calls column masking experimental - two field descriptions left over from before 0.20.
- A test holds the MCP server's key fetching to no redirects - PyJWT's own behaviour, from 2.14, the floor.
- CI tests the lowest version allowed of every core dependency, and of the
mcp,jwtandredisextras (ADR 0017) - the whole suite on Python 3.11, with Redis. It tested only DuckDB's and sqlglot's before. A test fails if a minimum in pyproject.toml and the version CI pins for it differ, or if a core dependency has no pin.
0.29.0 - 2026-10-12¶
The answers a security review asks for, written down and kept true: where every kind of data goes, for how long and who reads it; values kept out of the logs; a person's data erased on request; and cryptography that is FIPS-approved throughout, tested under OpenSSL's FIPS provider.
Upgrading from 0.28¶
- The image's access log no longer has query strings or referrers. A log pipeline that parsed them:
QUERYAPIGATE_ACCESS_LOG_QUERY=1brings the query string back. Acommand:override of the image needs-c python:queryapigate.gunicorn_confto keep the new format. - No schema change.
Added¶
- Where data goes (BACKLOG #101, ADR 0016): documentation/DATA_PROTECTION.md - every place QueryAPIGate keeps or sends data: what, for how long and by which setting, who reads it, what is never kept, and the categories of personal data - for a record of processing or a security questionnaire. A test fails if a table of the store, a setting that bounds what's kept, or a way data leaves isn't on it.
- FIPS 140: every algorithm QueryAPIGate uses is FIPS-approved - a test fails if the code gains one that isn't -
and Where data goes lists each use and says how to run on a
validated module: Red Hat Enterprise Linux 9 or Ubuntu Pro FIPS, with Python and
cryptographyfrom the distribution (PyPI's wheel carries an unvalidated OpenSSL), and the database drivers built against it. A new CI job runs the whole suite in Red Hat UBI 9 with OpenSSL's FIPS provider forced, and first checks that it is. - Forgetting a person:
queryapigate history forget CALLER(--dry-run) andDELETE /api/v1/history?caller=delete every run by a caller -jwt:alice@example.com- and their usage counts, in the store and in Redis. Audited asforget_callerby the caller's SHA-256, not their name. Owners only (history.forget). Guide 57, Answer a security questionnaire about data and cryptography, every answer checked on a running server.
Changed¶
- The access log leaves query strings out. The image's gunicorn (
-c python:queryapigate.gunicorn_conf) andqueryapigate servelog the request's path without its query string - parameter values sent in the URL - and never the referrer.QUERYAPIGATE_ACCESS_LOG_QUERY=1keeps the query string. Acommand:override of the image needs-c python:queryapigate.gunicorn_confto keep this. - With
QUERYAPIGATE_HISTORY_ADHOC_SQLhashornone, the log shows statements by their SHA-256 too - an ad-hoc statement, or a legacy{name}placeholder, can carry a value in its text.
0.28.0 - 2026-10-12¶
No database password anywhere: a connection's secrets come from where they live - a file the CSI driver or Vault Agent keeps current, Vault, AWS Secrets Manager - and its credentials can be short-lived, made by Vault per lease or as RDS IAM tokens, rotated with no failed call. Nothing is reachable until the deployer lists it, and a provider that fails is forgiven only within what it gave before. Experimental in 0.28.
Upgrading from 0.27¶
- No schema change. Nothing changes for a deployment that sets none of the new settings - except the TLS fix
below: a PostgreSQL or MySQL connection whose
sslmodeorssl_*asked for more than its server gives now fails instead of connecting without it.
Security¶
- A PostgreSQL or MySQL connection's TLS settings are now given to its driver.
sslmode(withsslrootcert,sslcert,sslkey,sslcrl) and MySQL'sssl_ca,ssl_cert,ssl_key,ssl_verify_cert,ssl_verify_identityandssl_disabledwere documented as passed through, and weren't: a connection set toverify-fullconnected without checking the server's certificate - with libpq's default,prefer, even without TLS when the server didn't offer it. They are passed now, and only these: a connection that asks for TLS the server can't give, or a certificate that doesn't verify, now fails instead.
Fixed¶
queryapigate servenow exits cleanly on SIGTERM, so what runs at exit does - the audit stream's lease given back (0.25), Vault leases revoked. It used to be ended without it. (The image's gunicorn already exited cleanly.)
Added¶
- Secrets from files (BACKLOG #98,
ADR 0015, experimental), first part: a
connection's or destination's field can be
${file:/run/secrets/name}- read when the connection is opened, again as soon as the file changes, so a password the CSI driver or Vault Agent rotates in place is used without a restart. Only insideQUERYAPIGATE_SECRET_FILE_DIRS, never the server's home, checked when saved and when used. Resolved values are kept in memory at mostQUERYAPIGATE_SECRET_CACHE_SECONDS; past that a failing provider fails the connection with503 secret_unavailable, never a stale secret. Every secret setting can be read from a file too:QUERYAPIGATE_SECRET_KEY_FILEand the like. Vault:${vault:secret/data/warehouse#password}from the KV engine, and a connection'scredentials: {source: vault-database, role: ...}- a username and password from the database secrets engine for each lease, shared by the connections opened during it, every pooled connection retired before its lease ends, and the leases revoked when the process exits. The server signs in with a token (or Vault Agent's token file), Kubernetes auth or AppRole;QUERYAPIGATE_VAULT_PATHSandQUERYAPIGATE_VAULT_DATABASE_ROLESsay what it may ask for. Tested in CI against Vault 1.21. AWS (theawsextra, in the image):${aws-sm:prod/warehouse#password}from Secrets Manager, by name or ARN, andcredentials: {source: aws-rds-iam} - an IAM token as the password for RDS and Aurora, PostgreSQL or MySQL, only over TLS - with IRSA through the
chart's
serviceAccount.annotations;QUERYAPIGATE_AWS_SECRET_PREFIXESandQUERYAPIGATE_AWS_RDS_HOSTS. The chart'svaultTokenmounts a projected token for Vault's Kubernetes auth. Thesecret_provider_failingalert, and each provider's last answer in Settings. A Vault database role can be bound to its database's host (reporting-ro@warehouse.internal), so its credentials go to no other. Guide 56, Use short-lived database credentials from Vault, run against Vault 1.21: 861 calls across four leases, none failed. See Secrets from files and secrets managers.
0.27.0 - 2026-10-12¶
A server's setup as a file in git: connections, saved queries, roles, keys' grants and the rest, with no secret in it, reviewed as a pull request against what the server holds now, and applied all or nothing - by CI, or by the server itself as it starts, which with the Helm chart makes a merge the deploy. Experimental in 0.27.
Upgrading from 0.26¶
- Schema 15 adds two tables,
config_managed(what a configuration file manages) andconfig_applied(every file applied, by its hash). Additive - 0.26 instances keep working on the upgraded store.
Added¶
- Configuration as code (BACKLOG #97, ADR 0014, experimental),
first part:
queryapigate config exportwrites a server's connections, destinations, roles, saved queries, API keys' grants, descriptions and exports as one YAML file, with no secret in it - passwords as${VAR}references, keys as their hashes.queryapigate config diff FILEsays, field by field, what applying a file would change, and reports every problem in it at once (exit 0, 2 or 1, asterraform plan -detailed-exitcode).config new-keymakes a key's secret and its hash.queryapigate config apply FILE(andPOST /api/v1/config/apply) makes the server match it, all or nothing: one transaction, every change through the API's own rules and auditedvia: config, under oneconfig_appliedentry with the file's hash.--prunedeletes only what a file manages (applied or named before), never what was made in the Console.POST /api/v1/config/difftoo; both owners only (config.apply). See Configuration as code.QUERYAPIGATE_CONFIG_FILEapplies a file at startup, once per file - with several instances, the first to start applies it - and one that can't be applied stops startup, changing nothing;QUERYAPIGATE_CONFIG_PRUNEprunes then too.QUERYAPIGATE_CONFIG_LOCKEDkeeps what a file manages to the file: the API and the Console answer409 config_managed.GET /api/v1/config/managed, and the Console tags what's managed. The Helm chart'sconfigAsCodemounts the file and rolls the pods when it changes - checked on kind, a file that can't be applied stopping the rollout at its first pod.config diff|apply --server URLruns against a running server, for CI. Guide 55, Promote a setup from dev to prod through a pull request, run against two real servers.
Security¶
- A connection or destination can't reference the server's own
OTEL_*settings (${OTEL_EXPORTER_OTLP_HEADERS}often holds a collector token), as it already couldn'tQUERYAPIGATE_*ones: an administrator could otherwise have one sent to a host of theirs as a password. One saved with such a reference stops working; give it a variable of its own. - An audit entry's copy in the export file is written once its transaction commits, so an entry rolled back - a configuration file that didn't apply - never appears there.
0.26.0 - 2026-10-12¶
QueryAPIGate on Kubernetes the way most teams install things there: helm install from ghcr, one pod on SQLite or
several on PostgreSQL and Redis, locked-down pods, and a chart that refuses setups that can't work. CI installs it on a
real cluster and upgrades it under load on every change. The chart is experimental in 0.26.
Upgrading from 0.25¶
- No schema change, and rolling upgrades from 0.25 work as usual.
- The image needs gunicorn 26 or later and passes
--no-control-socket. If you override the image'scommand:, add the flag (DEPLOYMENT.md's example has it). Without it gunicorn writes a control socket under the home folder, which a read-only root filesystem doesn't allow.
Added¶
- A Helm chart (BACKLOG #100, ADR 0013, experimental):
deploy/helm/queryapigate, for Helm 3 and 4, released with the server (chart X.Y.Z runs X.Y.Z). One pod on SQLite with its store on a volume, or several on PostgreSQL and Redis rolled one at a time behind a disruption budget; the secrets from a Secret you manage (or one the chart makes), every other setting asconfig; ingress with/eventsrouted to the events server, the MCP server on its own host; locked-down pods (non-root, read-only root filesystem, no capabilities); a ServiceMonitor, NetworkPolicy and autoscaler if you want them.helm installrefuses what can't work - more than one pod on SQLite or without Redis, a secret setting inconfig(plain text in the Deployment) - andvalues.schema.jsona misspelt value.extraVolumesfor files settings name by path, such as the SIEM's certificates. Published with each release:helm install queryapigate oci://ghcr.io/anantharajuc/charts/queryapigate --version 0.26.0. CI lints it with Helm 3 and 4, renders every option, and installs it on kind, upgrading from the previous release with requests running and failing on a single failed request. Guide 54, Install on Kubernetes with Helm, run on kind; Kubernetes (Helm) in the deployment guide.
Changed¶
- The image starts gunicorn with
--no-control-socket(and gunicorn 26 or later): its control interface, unused, wrote under the home folder - the one write outside/dataand/tmp. The image now runs on a read-only root filesystem. deploy/kubernetes/queryapigate.yamlruns its pods the same way - non-root, read-only root filesystem, no capabilities, no service account token - and gives the events server a liveness probe. A test keeps it in step with what the chart renders.
Fixed¶
- On several instances, the example queries answered 404 from every instance but the one that loaded them: the store said they were there, but their SQLite database was a file only that instance had. Each instance now makes its own copy when it's missing. Found by the new Kubernetes test in CI.
- The threat model still said the audit log wasn't tamper-evident, in two places 0.25 missed. It now says what the chain shows and what only a copy outside the store does. It also gains a section on running on Kubernetes.
0.25.0 - 2026-10-12¶
An audit trail an auditor can rely on: every administrative change chained to the one before and signed, checked in one command, and streamed as it happens - over mutual TLS - to the SIEM where security teams already look, without losing an entry while it's down. The chain is stable; the stream is experimental.
Upgrading from 0.24¶
- Schema 14 adds three columns to
audit_log(seq,prev_hash,hash) and two tables (audit_chain,audit_delivery). The entries already stored are chained at the upgrade, as they are, and anaudit_chain_startedentry records when. A 0.24 instance still running keeps writing entries without a link; the next upgraded write links them in - but upgrade every instance.
Added¶
- A tamper-evident audit log (BACKLOG #96, ADR 0012):
each entry chained to the one before (
seq,prev_hash,hash), HMAC-signed withQUERYAPIGATE_AUDIT_KEYwhen set (rotated asnew,old), plain SHA-256 otherwise; the chain kept through the rolling cap by an anchor.queryapigate audit verify [--file]andGET /api/v1/audit/verifyname the first entry that doesn't verify - changed, missing, out of order, or re-written without the key - and theaudit_chain_brokenalert says so. The export file's lines carry the chain too. See A tamper-evident chain. - The audit log streamed to a SIEM (ADR 0012, experimental): syslog (RFC 5424) over TLS - mutual TLS too - or
TCP, with
QUERYAPIGATE_AUDIT_SYSLOG_URL; OTLP logs withQUERYAPIGATE_AUDIT_OTLP=1. A cursor per output in the store and a lease, so one instance delivers and another takes over; at least once; entries not yet delivered kept past the rolling cap, up to ten times it.GET /api/v1/audit/deliveryand theaudit_delivery_behindalert. See Streaming the audit log to a SIEM. A process that exits cleanly gives its lease back, so another takes over at once. Guide 53, Send the audit log to your SIEM, run against syslog-ng over mutual TLS.
0.24.0 - 2026-10-11¶
Limits a contract can be written in: a key or role can cap the queries it runs at once, how long each may run and how many rows a call returns - so one partner can't starve the rest - and carry a quota of calls and rows per day or month, enforced across every instance and reported on every response. The limits are stable; quotas are experimental.
Added¶
-
Per-key limits on concurrency, time and rows (BACKLOG #94, ADR 0011):
max_concurrent,query_timeoutandmax_rowson keys and roles, each narrowing the server's own limit, never widening it, on every front door - REST, ad-hoc SQL, MCP tools.max_concurrentcounts queries running at once, a stream until its last row is read, across instances through Redis, with leases so a dead process's slots free themselves; over it,429 too_many_concurrent. A key shows itseffective_limits. See Per-key limits. -
Usage quotas (BACKLOG #95, ADR 0011, experimental):
"quota": {"calls": 100000, "rows": 10000000, "per": "month"}on keys and roles - calendar days or months, per caller (per user for signed-in users). Successful data calls and their rows count, cached responses included; used up,429 quota_exceededwithresets_at.X-Quota-Remaining-Calls,X-Quota-Remaining-RowsandX-Quota-Reseton every response to a caller with one; a key'susage_this_period,GET /api/v1/usage/quotasand thequota_nearly_usedalert. Counted in the store (schema 13,usage_counters) through the run-history batch, not a write per call, and with several instances in Redis, one counter for all of them: measured, 1,016 calls answered for a quota of 1,000 on two instances under load (1,615 without Redis). See Usage quotas. X-Row-Counton every paged data response: the rows in it.- The Console: the key and role forms take Queries at once, Time limit, Rows per call and a Quota; the API keys list shows how much of its quota each key has used, amber from 80%, red when used up. Guide 52, Give a partner a quota and a concurrency cap, with the precision measured.
Upgrading from 0.23¶
- Schema 13 adds one table (
usage_counters); nothing existing changes. A 0.23 instance still running keeps working against the upgraded store, but doesn't count or enforce quotas - upgrade every instance before giving a key one.
Fixed¶
- A streamed response closed before its first chunk - the client gone at once - left its query counted as active and its database connection checked out until garbage collection: closing a generator that never started runs none of its code. The response now closes the rows itself.
0.23.0 - 2026-10-11¶
Seeing inside, and hardened at the edge: QueryAPIGate's spans in your traces - from the app's request through the saved query to the database - without a parameter value, row or secret ever leaving in one; and security headers on every response, so none depends on a proxy to add them. Tracing is experimental; the headers are stable.
Added¶
- Tracing with OpenTelemetry (BACKLOG #92, ADR 0010,
experimental):
pip install "queryapigate[otel]"and setOTEL_EXPORTER_OTLP_ENDPOINT- every otherOTEL_*variable works as usual. Spans for each request (by route rule), saved query, database call, serialisation, MCP tool call, live stream opened and export, continuing a caller'straceparent(andTRACEPARENTforqueryapigate export).trace_idin run history, error bodies and JSON log lines. Spans never hold parameter values, rows, statements, headers or secrets - a test fails if one does; an MCP client's tool name only when it is well formed. Measured: about 1 ms a request with every request traced, nothing measurable at 10% sampling. Guide 51, See QueryAPIGate in your traces. See Tracing. The Docker image includes the extra: set the endpoint to turn it on. - Security headers on every response (BACKLOG #93, ADR 0010):
X-Content-Type-Options: nosniff; on API responsesContent-Security-Policy: default-src 'none'; frame-ancestors 'none'andReferrer-Policy: no-referrer;Cache-Control: no-storeunless the route says otherwise - on the main server, the MCP server andqueryapigate events, so none relies on a proxy to add them. HSTS whenQUERYAPIGATE_HSTS_MAX_AGEis set, only on requests that arrived over HTTPS. See Security headers.
Changed¶
/docsloads one exact Swagger UI release (5.33.0), with Subresource Integrity hashes and a CSP that allows only those files and the page's own script - it loaded the newest 5.x from the CDN, unchecked, on the page where people type their API key.- Responses are
Cache-Control: no-storeunless they say otherwise (a cached saved query'sprivate, max-age=N, the Console's assets). A client that kept API responses in its HTTP cache no longer may. - No version banner:
queryapigate serveanswersServer: QueryAPIGate(was Werkzeug's and Python's versions); the MCP server sends noServerheader.
0.22.1 - 2026-10-11¶
Security¶
- A cached saved query's response could be kept by a shared cache in front of the server (0.4.0 to 0.22.0). A
saved query with
cache_ttlanswered withCache-Control: max-age=<cache_ttl>. Callers authenticate withX-API-Key, notAuthorization, so HTTP's rule that keeps authenticated responses out of shared caches doesn't apply: a CDN or caching proxy between callers and QueryAPIGate could store one caller's rows - masked or filtered for that caller's key - and serve them to the next request for the same URL, with any key or none. The server's own response cache was never affected: it checks the caller's grant before answering, and keys each response by its parameter values and the caller's masking rules. Now it isCache-Control: private, max-age=<cache_ttl>, on hits and304s too. To check whether it could have happened: whether anything in front of the server caches responses, and whether it honouredmax-ageon/q/paths.
0.22.0 - 2026-10-11¶
Rotating secrets without downtime: the key stored passwords are encrypted with, and an API key's secret, can each be
replaced while everything keeps working - several encryption keys at once and queryapigate rekey, and a reissued
API key whose old secret works for a grace period you choose. Both are stable from the start, so 1.0 freezes them.
Upgrading from 0.21¶
- Schema 12 adds two nullable columns to
api_keys(previous_hash,previous_expires_at) and an index; nothing existing changes. A 0.21 instance still running keeps working against the upgraded store, but doesn't know a rotated key's old secret - so upgrade every instance before rotating a key.
Added¶
- Reissuing an API key's secret (BACKLOG #91, ADR 0009):
POST /api/v1/api-keys/{name}/rotategives a key a new secret, shown once, while the old one keeps working forgrace_minutes(default 60, at most a week; 0 for a leaked secret) - same name, same grants, the same history, so whoever uses the key switches without an outage.previous_expires_atandprevious_last_used_aton the key show whether they have;DELETE /api/v1/api-keys/{name}/previousends the grace early. A second rotation while an old secret still works is refused (key_rotation_pending). Audited asrotate_api_keyandend_previous_secret. -
Rotating the encryption key (BACKLOG #90, ADR 0009):
QUERYAPIGATE_SECRET_KEYtakes several keys, comma-separated - the first encrypts, every one decrypts - andqueryapigate rekey(orPOST /api/v1/settings/rekey, owners only: the newsecrets.rotatecapability) re-encrypts every stored connection and destination password under the first, in one transaction: all of them, or none when one can't be decrypted by a listed key.--check({"check": true}) only reports how many are under each key. Until the old keys are removed, startup logs it, Settings shows it, and theencryption_key_rotation_incompletealert says what's left. Audited asrekey, with counts only. One key behaves exactly as before. Guide 22's Changing the key. -
The Console: API keys → Edit → Secret rotates a key (keeping the old secret working for an hour, a day, a week, or not at all), shows the new secret once, and shows an old secret's expiry and last use, with End now; a key being rotated is tagged rotating. Guide 50, Rotate an API key without downtime.
Fixed¶
- A destination password saved before
QUERYAPIGATE_SECRET_KEYwas set stayed in plaintext. Startup encrypts literal passwords already in the store, but only connections' were; destinations' are now too.
Changed¶
password_undecryptablenow says that no listed key decrypts the password, and how to fix it. Each key inQUERYAPIGATE_SECRET_KEYis validated at startup by its place in the list; the same key twice is refused.
0.21.0 - 2026-10-11¶
Agents that act, governed: an AI agent may write through a saved query its author marked for agents - opening a ticket by itself, or closing one only once a named person has approved that exact change. Every agent write runs in a transaction, rolled back past the rows it may change, runs once, and is on record with who asked and who approved. Experimental.
Upgrading from 0.20¶
- Schema 11 adds one table (
write_requests); nothing existing changes. A 0.20 instance still running keeps working against the upgraded store, but can't be restarted on it - upgrade every instance.
Added¶
- Write tools over MCP, each write approved by a person (BACKLOG #88,
ADR 0008, experimental): a saved query its author marks
agent_writes- one INSERT, UPDATE or DELETE, never DDL - is a write tool for callers whose grant allows the write. With"approval"the first call asks, an administrator withwrites.approveapproves it (/api/v1/write-requests), and the second call runs it once, with exactly the approved arguments;"insert"runs an INSERT at once, with an idempotency key. Every agent write runs in a transaction, rolled back past itsmax_affected_rows. On PostgreSQL, MySQL, SQLite and DuckDB. The Console's Approvals screen (and the link each agent is given) shows the SQL and the exact arguments to approve or reject; awrites_awaiting_approvalalert and the Agents screen's write counts follow them. The credential that asked can never approve (own_write), an agent can't pile up more than 100 waiting writes, and the audit log records the arguments' names and hash - never their values. What a write returns (RETURNING) is masked like any read. Guide 49. See Write tools.
0.20.1 - 2026-10-11¶
Security¶
- A saved query that writes could be run over MCP by calling it by name (0.11.0 to 0.20.0). The MCP server lists
only read-only saved queries as tools, but a call naming one that writes wasn't refused - so an agent holding a key
whose grant allowed that write (
{"name": "...", "allow_writes": true}, withQUERYAPIGATE_ALLOW_WRITESon) could run it unsupervised, including an older version that writes throughversion. It reached nothing the same key couldn't do over REST, but it broke the promise that agents only read. Now a saved query whose SQL writes is refused over MCP before it runs (read_only), whatever the version and the grant. To check whether it happened: run history entries with"transport": "mcp"for a saved query that writes.
0.20.0 - 2026-10-11¶
A consolidation release: four features leave the experimental list and come under the compatibility promise - alerts, remote files through DuckDB, exports to object storage and column masking - on terms now written into the versioning policy. Getting them there found two dependency minimums that weren't true (sqlglot for masking; DuckDB, fixed in 0.19.1), and CI now tests against real S3, a real identity provider and the oldest dependencies allowed.
Upgrading from 0.19¶
queryapigate[flow]needs sqlglot 25.2 or later (was 23). pip upgrades it with QueryAPIGate; an install that pins an older one keeps everything but column masking working, and masked callers getmasking_unavailablesaying so.- Nothing else changes: no schema change, and the graduated features work exactly as in 0.19.
Changed¶
- Alerts, remote files through DuckDB, exports to object storage and column masking are stable - under the
compatibility promise, no longer experimental: each met the graduation terms now written into the versioning policy
above (tested for real in CI, security-reviewed, unchanged for a release, gaps closed or stated, tested on the oldest
dependencies allowed). Each one's documentation says what may still be added: new alert kinds and fields (a client
should ignore a
kindit doesn't know); storage types and connection fields; export formats, path placeholders and fields; masking actions, and query shapes masking can follow. Their startup warnings,x-experimentalmarks and Console tags are gone. - Column masking needs sqlglot 25.2 or later, the first its tracing works on -
queryapigate[flow]asked for 23, and on 23.0 to 25.1 a masked caller's query failed inside the parser (refused, never unmasked). An older sqlglot pinned by something else now getsmasking_unavailable, naming the version and the upgrade.
Fixed¶
- A table function run by a table-restricted key answered
500instead oftable_not_allowedon older sqlglot releases (25.2 among them): the check looked for an expression class they don't have. Refused either way.
Added¶
- CI tests against real services and the oldest dependencies: the integration job runs exports, files on S3, the MCP server's OAuth and Console sign-in against SeaweedFS and Keycloak, none allowed to skip; a new job runs the DuckDB, masking and table-check tests on Python 3.11 with DuckDB 1.2.0 and sqlglot 25.2.0, the lowest versions allowed. Column masking is tested against real PostgreSQL, MySQL and ClickHouse - in their own SQL - on every push.
0.19.1 - 2026-10-11¶
Fixed¶
- DuckDB connections need DuckDB 1.2 or later - and now say so.
queryapigate[duckdb]asked for DuckDB 1.0, but since 0.15 every DuckDB connection is locked to itsallowed_pathswith settings that arrived in DuckDB 1.2: on 1.0 and 1.1 every DuckDB connection - files, exports and plain databases alike - failed with unrecognized configuration parameter "allowed_directories". It never opened one unlocked.queryapigate[duckdb]now requires 1.2, and an older DuckDB pinned by something else getsdriver_missing, saying which version is installed and how to upgrade. Verified on DuckDB 1.2.0 and 1.5.5, files and exports on S3 included. The Docker image ships a current DuckDB and was never affected.
0.19.0 - 2026-10-11¶
The people who govern QueryAPIGate sign in the way agents already do: administrators sign in to the Console through the organisation's identity provider, with its MFA and policies, and their role comes from the groups they're in there - someone leaving or moving team changes their access at their next sign-in. Administrators who had tokens keep their names and history. Experimental.
Upgrading from 0.18¶
- Schema 10 adds two tables (
admin_sessions,sso_logins); nothing existing changes. A 0.18 instance still running keeps working against the upgraded store, but can't be restarted on it - upgrade every instance.
Added¶
- Console sign-in through SSO (BACKLOG #84 Phase 2, ADR 0007,
experimental): administrators sign in through the organisation's identity provider (OpenID Connect, the
authorization code flow with PKCE, run by the server), with their role from their groups at every sign-in
(
QUERYAPIGATE_SSO_ROLES) and an administrator created on first sign-in. The session is aSameSite=Strict,HttpOnlycookie that authenticates only together with its CSRF token. Administrators who had tokens are linked at their next SSO sign-in ({"sso": "pending"}), their role then their groups';QUERYAPIGATE_SSO_ONLYtakes personal tokens from people who sign in through SSO. The Console offers Sign in with SSO, and a new alert,sso_unreachable, says when sign-in is down. See Console sign-in through SSO and guide 48.
Changed¶
- An identity provider's metadata is checked more strictly, for the MCP server's OAuth too: a document listing any plain-HTTP endpoint (keys, authorization, token, sign-out) is refused whole, not only one whose keys are. It is fetched again every hour, and the last good one kept while the provider can't be reached.
0.18.0 - 2026-10-11¶
Letting AI agents near your data, governed: hosted AI clients sign in through your identity provider, with tokens bound to the MCP server; agents are told what tables and columns mean - imported from the database's own comments or written in the Console - so they write the right SQL; and you can see what each agent did, with an alert when one suddenly reads far more than usual. All three are experimental.
Upgrading from 0.17¶
- Schema 9 adds one table (
descriptions); nothing existing changes. A 0.17 instance still running keeps working against the upgraded store, but can't be restarted on it - upgrade every instance. - The MCP server answers a missing or wrong credential with HTTP
401, not a tool error inside a200- and a rate-limited client with429. A client with a valid key or token sees no change.
Added¶
- OAuth for the MCP server (BACKLOG #85, ADR 0006,
guide 46,
experimental): hosted
AI clients sign in through your identity provider.
/mcpbecomes an OAuth 2.1 resource server - Protected Resource Metadata at/.well-known/oauth-protected-resource,401/403withWWW-Authenticate- accepting tokens that name its own URL as their audience (QUERYAPIGATE_MCP_RESOURCE_URL) from the provider inQUERYAPIGATE_MCP_AUTH_SERVER, with a scope and a role (QUERYAPIGATE_MCP_SCOPE,QUERYAPIGATE_MCP_ROLE,QUERYAPIGATE_MCP_ROLE_CLAIM). The role's grants and masking rules apply to the agent, whose runs are underjwt:<sub>- ormcp:<sub>when REST trusts another provider, so two people never share a name. REST and MCP tokens are kept apart: neither is accepted by the other. See Sign-in for AI clients. - Descriptions (BACKLOG #86, ADR 0006, experimental): what each table
and column means, and a connection's notes (the joins to use, how a metric is worked out) -
/api/v1/connections/{name}/descriptions, written in the Console's schema browser or imported from the database's own comments (PostgreSQL, MySQL, ClickHouse, DuckDB). Served with the schema, in MCP'slist_tablesand as a data dictionary MCP resource per connection - only for the tables a caller can reach, marking the columns it gets masked. A saved query describes its result columns (columns), in its MCP tool's output schema. See Descriptions and guide 47. - Agent usage (BACKLOG #87, experimental):
GET /api/v1/usage/agentsand the Console's Agents screen - per AI agent on the MCP server, its calls, rows read, refusals by code, how often masking applied, the saved queries it ran and its most frequent ad-hoc statements, from run history. A new alert,agent_unusual_volume, warns when an agent reads ten times its usual hourly rows, pastQUERYAPIGATE_ALERT_AGENT_ROWS(default 10,000). See Agent usage.
Changed¶
- The startup warning for an experimental feature reads
Experimental: <feature> (<what shows it>) - ..., so it reads right for every feature's name ("OAuth for the MCP server are experimental" didn't). Log searches forare experimentalneed the new wording.
0.17.0 - 2026-10-11¶
Delivering data to partners and pipelines: a saved query can be exported to a bucket or folder as Parquet, CSV or NDJSON - incrementally, a file of only what changed each run - and column masking hides personal data from the callers you hand it to, traced through the SQL so a renamed column doesn't slip past. Both are experimental. A security review before release keeps exports, connections and the store out of an administrator's reach, and three fixes reach back into 0.16: Parquet output in steady memory, a stream closed before its first row, and switching keys in the Console.
Upgrading from 0.16¶
Nothing has to change for what you run today; check two things if they apply to you.
- Schema 8 adds three tables (destinations, exports, server_secrets); nothing existing changes. A 0.16
instance still running keeps working against the upgraded store, but can't be restarted on it - upgrade every
instance.
- A ${VAR} reference to a QUERYAPIGATE_* setting in a connection is now refused - the connection fails with
connection_misconfigured until it refers to a variable of its own (one that isn't a server setting).
- A connection that opens the server's own queryapigate.db - by database, or a DuckDB allowed_paths folder
containing it - is now refused (store_not_allowed).
- Local-folder export destinations need QUERYAPIGATE_EXPORT_DIRS; object-storage destinations need nothing.
Added¶
- Destinations (BACKLOG #89, ADR 0004,
guide 44,
experimental - with saved exports below, exports to object storage):
/api/v1/destinations- ans3://,gs://orr2://prefix, or a local folder, and the credentials to write there, stored like a connection password (masked,${VAR}, or encrypted withQUERYAPIGATE_SECRET_KEY). Every write goes through a DuckDB connection locked to that prefix, so nothing can be written elsewhere;POST /api/v1/destinations/{name}/testwrites a probe object to prove the url, credentials and permission together. Owners and admins define destinations (destinations.write); every administrator can read them. Exports need DuckDB (queryapigate[duckdb], in the Docker image); without it they say so (exports_unavailable). queryapigate export QUERY --to DESTINATION --out PATHwrites a saved query's full result under a destination as Parquet, CSV or NDJSON, through DuckDB:--out 'orders/{date}/orders_{run}.parquet'- with{name},{date},{time},{run}and the query's own parameters ({region}), whose values may only be plain names, so none can add a folder or climb out. Each run is in history (transport: "export", the destination and the object written).- Saved exports (experimental):
/api/v1/exports- a saved query, its parameters, a format, a destination and an object path, run withPOST /api/v1/exports/{name}/runsorqueryapigate exports run NAME(scheduling stays with cron, a CronJob or Airflow). Incremental: each run binds the largest value of a column it last delivered to a parameter (WHERE updated_at > :since), so a file holds only what changed; the watermark moves only after the file is written, so a failed run is sent again, never lost - and a value the parameter wouldn't accept back is refused before anything is written. One run at a time per export (409 export_running, a lease that a crashed run can't hold for ever). Runs are in history, and theexport_failingalert fires while an export's newest run failed. Owners and admins define exports (exports.write); developers may run them (exports.run). - Column masking (BACKLOG #63, ADR 0005,
guide 45,
experimental): a
maskgrant on API keys and roles, and on exports - rules on source columns (customers.email,*.phone) thathash,mask,nullordroptheir values in everything that caller receives:/q/<name>,/execute_sql, every format, streamed exports, MCP tools and exports. Each result column is traced through the SQL to the table columns it comes from - aliases, expressions, CTEs, unions and joins don't get around it - and a query that can't be traced is refused (403 mask_unresolvable) before it runs, never served unmasked. Cached responses are kept per set of rules; run history records what was masked; a caller with rules never sees the database's own error text.GET /catalogtells such a caller which of each query's columns it gets masked, and how. In the Console: rules in the API key, role and export forms, and a "masked" tag on keys and roles - and on the Access map - that carry them. - Exports and Destinations in the Console (a new Delivery group): define a destination and test it before saving; define an export - query, destination, format, file path, parameters, incremental column - run it with Run now, and see its runs. Each role sees what it may do: owners and admins everything, developers the Run button, auditors the lists.
Fixed¶
- Parquet output now runs in steady memory. DuckDB wrote Parquet with a thread per core, each buffering its share,
so memory grew with the result: about 600 MB for 2 million rows and 1.4 GB for 6 million, for
?format=parquet(paged or streamed) andqueryapigate export --format parquetalike. It now writes on one thread - about 150 MB at either size, at the same speed, and rows always keep the query's order. - A stream closed before its first row ends its query.
?stream=trueandqueryapigate exporthand back rows as they come; a caller that stopped before reading one - a client gone before the first chunk - left the query counted inqueryapigate_active_queriesand its pooled connection checked out until garbage collection. - Switching keys in the Console's key box no longer briefly keeps the previous key's role - the sidebar could show screens the new key can't use until something else redrew it.
- The OpenAPI alert
kindenum lists every alert -break_glass_used(0.16) and the instance and Redis alerts were missing from it.alerts.KINDSis now the one list, checked against the docs.
Security¶
- Exports, connections and the store are kept apart from an administrator's reach (the 0.17 pre-release review,
now that
adminis a role belowowner): a local-folder export destination is off unless the operator setsQUERYAPIGATE_EXPORT_DIRS, must sit inside a folder listed there, and is never the server's home - so no export can write over the store or elsewhere on the host; a connection can't be pointed at the server's ownqueryapigate.db(store_not_allowed), bydatabaseor by a DuckDBallowed_pathsfolder containing it; and a${VAR}reference in a connection or destination can't name one of the server's ownQUERYAPIGATE_*settings. Object-storage destinations are unaffected - their credentials bound them.
0.16.0 - 2026-10-06¶
Named administrators replace the one shared admin key - each person or pipeline with a role, their own tokens, and an
audit log that says who changed what - which completes the last change to the management API before the 1.0 freeze.
Any query can come back as Parquet, a folder or bucket of files becomes a set of tables by itself, and the read-only
guard closes a gap that let DuckDB, H2 and JDBC connections run writes hidden behind EXPLAIN ANALYZE or a CTE.
Upgrading from 0.15¶
Nothing has to change: no route, setting or stored field is removed, and the shared key keeps working.
- Schema 7 adds two tables (administrators, admin_tokens); nothing existing changes. A 0.15 instance still
running keeps working against the upgraded store, but can't be restarted on it - upgrade every instance.
- QUERYAPIGATE_API_KEY keeps working, as an owner. To give people their own access and retire the shared key,
follow guide 43.
Once a named owner exists, each use of the shared key is logged and raises the break_glass_used alert. The startup
warning about scoped keys without QUERYAPIGATE_API_KEY is no longer logged once an active owner exists.
- Read-only is stricter (see Security): with writes off, a statement that hides a write behind WITH, EXPLAIN
ANALYZE or SELECT ... INTO is now refused with read_only on every database type - on PostgreSQL, MySQL,
ClickHouse and SQLite those already failed, in the database. A key's allowed_write_ops counts those writes too.
- The Management API checks roles: a caller that isn't an administrator gets 403 admin_only, as before; an
administrator whose role lacks an operation's capability gets 403 role_forbidden. The shared key is an owner, so
existing scripts are unaffected.
Added¶
- Parquet output (BACKLOG #81):
?format=parqueton any query and any database type - paged or streamed - andqueryapigate export --format parquet. Written by DuckDB (no new dependency; in the Docker image), with column types taken from the values - decimals stay exact, dates and timestamps stay typed. The Console's format pickers offer it and download the file. On the example APIs' 20,000-row export: 513 KB of Parquet against 2.2 MB of CSV. Arrow IPC output is still open: it would needpyarrow, a large new dependency. - Automatic views over files (DuckDB connections, experimental with remote files):
"auto_views": truemakes a view of each file and each subfolder under the connection's allowed folders and bucket prefixes -orders.parquetbecomesorders; a folder of Parquet files, with hive-stylekey=value/partitions, becomes one view over all of them. Views inviewstake precedence; a file that can't be read is skipped with a warning. - A "Files (Parquet, CSV, JSON)" connection type in the Console: a DuckDB connection with no database file of its own and automatic views on - choose the folders or buckets it may read, and each file is a table to query.
- Named administrators with roles (BACKLOG #84 Phase 1, ADR 0003,
guide 43): administrators - people or pipelines - each with a role (
owner,admin,developer,auditor) and their own admin tokens (qagadm_..., sent asX-API-Key, stored only as hashes, with an expiry). Every/api/v1operation needs a capability its caller's role holds (403 role_forbiddenotherwise);GET /api/v1/mesays who the caller is.queryapigate admins create|token|listcreates the first owner without a server. Audit entries gainvia(token,break-glass,open,cli,startup).QUERYAPIGATE_API_KEYkeeps working as an owner - the break-glass key: once a named owner exists, each use is logged and raises abreak_glass_usedalert. Authentication stays required while any administrator exists, even withQUERYAPIGATE_API_KEYunset. Moving a query or merging collections in a way that gives an API key or role new reach takes an owner or admin (access.write) - a developer organises queries but doesn't decide who can call them./api/v1/administratorsmanages administrators and tokens (owners; anyone manages their own tokens). In the Console: an Administrators screen (owners see everyone; others, their own account and tokens), "Signed in as alice · Developer" in the sidebar, and screens and actions a role can't use are hidden.
Security¶
- Writes hidden behind a read-only statement are refused. The read-only guard classified a statement by its first
keyword, so with writes switched off a DuckDB connection - opened read-write, with the guard as its only lock - ran
EXPLAIN ANALYZE DELETE FROM t(emptying the table) andWITH x AS (...) INSERT ...; H2 and JDBC connections are in the same position. The guard now also finds writable CTEs, the statementEXPLAIN ANALYZEruns, andSELECT ... INTO, and refuses them (read_only), ignoring literals, quoted names and comments. A key'sallowed_write_opsis checked against those too: a key limited toinsertcould delete through a writable CTE on PostgreSQL. Response caching and the MCP tool list use the same rule. PostgreSQL, MySQL, ClickHouse and SQLite refused these writes already, in their read-only sessions.
0.15.0 - 2026-10-04¶
Several instances become a supported deployment shape - shared rate limits, an instance list, a rolling-upgrade rule and test, and reference deployments for Compose and Kubernetes - files in buckets and on the web can be published through DuckDB, and what 0.14 deprecated is removed before the 1.0 freeze.
Upgrading from 0.14¶
Read these first.
- Breaking: POST /execute_sql_from_file and POST /execute_sql_with_parameters_from_file are removed - call
/q/{name} (GET or POST) instead. 0.14 marked them deprecated, with Deprecation headers and a log line naming each
caller's key.
- Breaking: the pre-SQLite JSON files are no longer imported. A home last run by 0.10 or older - 0.14's notice
said 0.9, but 0.10 still kept saved queries, keys, roles and the audit log in those files - must be started once by
0.14 first. 0.15 refuses to start on one, saying so, rather than start without its data.
- Breaking: a DuckDB connection reads only the files its new allowed_paths lists - none by default. List the
folders and files your DuckDB queries read, as absolute paths.
- The store is upgraded to schema 6 on first start (a new instances table) - additive, so a 0.14 instance still
running against it keeps working during a rolling upgrade. Back up first anyway.
- Running several instances? Give them all the same QUERYAPIGATE_REDIS_URL: rate limits are now shared through
it, and an alert says when some instances run without it. See DEPLOYMENT.md's Scaling out.
- The Docker image is about 90 MB larger - it now includes every optional feature the docs describe.
Breaking¶
POST /execute_sql_from_fileandPOST /execute_sql_with_parameters_from_fileare removed (deprecated in 0.14, BACKLOG #67) -/q/{name}runs the same saved query by name.- The pre-SQLite JSON files are no longer imported (deprecated in 0.14). A home with data only in them (0.10 or older) is refused at startup with what to do: start 0.14 on it once.
- A DuckDB connection reads only the files its
allowed_pathslists (BACKLOG #75). Before, any key that could run SQL on a DuckDB connection could read any file the server's user could -read_csv('/etc/passwd')included. Now a connection with noallowed_pathsreads no files at all; list the folders and files a connection's queries use (absolute paths), e.g."allowed_paths": ["/data/sales/"]. DuckDB itself enforces it: each connection's configuration is locked as it opens. A refused path answers403 path_not_allowed.
Added¶
- Several instances, supported (BACKLOG #56, #70): one instance, or several on a PostgreSQL store with Redis,
are both supported deployment shapes.
deploy/scale-out/is a reference Compose deployment (three instances, PostgreSQL, Redis, the events server, Caddy) anddeploy/kubernetes/the same on Kubernetes (Deployment, probes, zero-downtime rolling updates, a PodDisruptionBudget, Ingress) - both run end to end, including failover and a rolling update under traffic. DEPLOYMENT.md's "Why one worker" became Scaling out; how-to guide 42 walks through both. - Which instances are running (BACKLOG #58):
GET /api/v1/instanceslists every process using the store - role, host, version, whether it shares limits through Redis - and two new alerts, also logged at startup, flag several instances without Redis (instances_not_shared) and instances on different versions (instances_versions_differ). The store moves to schema 6 for it (a newinstancestable), upgraded automatically on first start. - Rolling upgrades, as a rule and a test (BACKLOG #58): within 1.x a release changes the store only additively,
so the previous release keeps serving on a store the new one has upgraded - DEPLOYMENT.md's Rolling upgrades.
tests/test_rolling_upgrade.pyruns the previous release from PyPI beside the current code on one store in CI. - One instance runs the history retention sweep: on a shared PostgreSQL store the instances take turns through an advisory lock rather than all deleting the same rows. The Grafana dashboard's stat panels sum across instances; DEPLOYMENT.md says how many PostgreSQL connections several instances need.
- Rate limits shared across instances (BACKLOG #55). With
QUERYAPIGATE_REDIS_URLset, the server-wide limit per client address and every key's (and signed-in user's)rate_limitare counted in Redis - an atomic token bucket on Redis's own clock - so every instance, andqueryapigate mcpandevents, enforce one budget instead of one each. If Redis fails, each process falls back to counting on its own (limits stay enforced, never lifted), tries Redis again after a few seconds rather than on every request, logs it at most once a minute, counts it inqueryapigate_rate_limit_fallbacks_total, and raises the newrate_limits_not_sharedalert. Settings shows where limits are counted. - A multi-server test (BACKLOG #57): CI starts three servers and an events server on one PostgreSQL store and one Redis, and checks that a change made through one - keys, query versions, connections, rate limits, the cache, history, the audit log, live events - takes effect on the others.
- Files on S3, GCS, R2 and the web as an API (BACKLOG #75, experimental): a DuckDB connection's
allowed_pathstakess3://,gs://andr2://prefixes andhttp(s)://files;user/passwordcarry the access key (masked, encrypted and${VAR}-capable like any password), withregion,endpoint,url_style,use_sslandstoragebeside them.database: ":memory:"makes a connection of nothing but files, andviewsnames them - for the schema browser, saved queries andallowed_tables. The Console's connection form has a section for all of it, the Docker image includes DuckDB'shttpfsextension, and how-to guide 41 walks through publishing a bucket.
Fixed¶
- A table-restricted key can't read data through a table function.
allowed_tableschecked the tables a statement names, butread_parquet(...),read_csv(...),glob(...)or ClickHouse'surl(...)name none, so they passed. They're now refused for such a key (table_not_allowed); pure generators (range,numbers,generate_series,unnest) still work.
0.14.0 - 2026-10-04¶
The groundwork for 1.0's promise: a deprecation policy and an "experimental" label for what's outside it, a database support matrix with tiers, backups you can restore, Python 3.11 or newer - and all 40 how-to guides, whose writing found and fixed the access-control and packaging gaps listed under Fixed.
Upgrading from 0.13¶
Read these first.
- Breaking: Python 3.11 or newer. On 3.9 or 3.10, pip keeps installing 0.13.0. The Docker image is unaffected.
- No store migration: the store stays at schema 5. Back up first anyway (how).
- Coming from 0.9 or older? Start 0.14 once before going further: 0.15.0 may stop importing the pre-SQLite JSON
files (Deprecated, below).
- Callers of /execute_sql_from_file or /execute_sql_with_parameters_from_file should move to /q/{name}
before 0.15.0. Each process logs the first such call with the key that made it.
- A key with "allowed_ips": [] now works from no address (it used to work from any). Find any with
GET /api/v1/api-keys and set them to null, or to real addresses.
- A table-restricted key's schema shows only its tables - a client that listed the rest no longer sees them.
Breaking¶
- Python 3.11 or newer is required (was 3.9). Python 3.9 reached its end of life in October 2025 and 3.10 reaches its own this month, so neither is carried into 1.0. pip on 3.9 or 3.10 keeps installing 0.13.0, the last release for them. The Docker image already runs Python 3.12 and is unaffected.
Deprecated¶
POST /execute_sql_from_fileandPOST /execute_sql_with_parameters_from_file(BACKLOG #67), in favour ofGETorPOST /q/{name}, which runs the same saved query by name. They work as before, now withDeprecationandLinkheaders,deprecated: truein/openapi.jsonand a log warning on first use; 0.15.0 may remove them.- Importing the pre-SQLite JSON files (
db_connections.json,saved_sql/,api_keys.json,roles.json,audit_log.json) on first start. A home last run by 0.9 or older should be started once by 0.14 before 0.15.0, which may stop reading them; stores from 0.10 on never wrote them. An import now logs a warning.
Added¶
- All 40 how-to guides are written - the 26 that were planned topics, from connecting via generic JDBC to
deciding how to expose QueryAPIGate: partner keys, roles, table and IP restrictions, rate limits, expiry, the audit
log, encryption, reverse proxies, MCP's ad-hoc tools and structured results, private live feeds, scheduled
exports, Docker, backups, upgrades, Prometheus and Grafana, logs, the connection pool, CORS and the threat model.
Every command and response in them was run against a real server, and the Console's Help lists them all.
tests/test_howto.pychecks every guide is listed and every link in them resolves. - A deprecation policy (BACKLOG #67), under Versioning and compatibility above: what is deprecated, how you'll find out, and how long it keeps working before it may go.
- A database support matrix (BACKLOG #66) in DATABASE_CONNECTION_CONFIGURATION.md: what each of the eight types
supports - read-only enforcement, time limits,
allowed_tables, schema browsing, streaming, MCP and more - and which are tier 1 (PostgreSQL, MySQL, SQLite, DuckDB, ClickHouse: every feature, tested against a real server in CI, covered by the compatibility promise) or experimental (H2, JDBC, MongoDB), with what an experimental type needs to become tier 1. The table is generated from the code that implements each feature (queryapigate/databases.py) and checked by a test, so it can't claim more than the code does. - Backups you can restore, documented and tested (BACKLOG #71).
queryapigate backup FILEcopies the SQLite store consistently while the server runs (SQLite's backup API, so nothing still in the write-ahead log is missed); on a PostgreSQL store it prints thepg_dumpcommand for its schema. DEPLOYMENT.md's Backups and restores covers both stores - backing up while serving, restoring, and what a backup doesn't contain:QUERYAPIGATE_SECRET_KEY(without it, encrypted connection passwords can't be read), the admin key, and variables connections refer to.tests/test_backup_restore.pyfills a store, backs it up, loses it, restores it and checks the admin API sees exactly what it saw, on SQLite and PostgreSQL alike. - PostgreSQL upgrade fixtures (the rest of BACKLOG #65): stores built by 0.12.0 and 0.13.0 on PostgreSQL, as
pg_dumpoutput, are restored and started under the current code in the PostgreSQL CI job. - An "experimental" label (BACKLOG #64) for features outside the compatibility promise - they may change in
any minor release, always noted here (see Versioning and compatibility above). Today: live events (
GET /events,queryapigate events), H2, JDBC and MongoDB connections, and alerts (GET /api/v1/alerts). Each is marked in its docs, withx-experimental: truein/openapi.json, with a tag in the Console (its Settings rows, the database-type picker, the Alerts screen), and with a warning in the log at startup while one is in use.
Changed¶
- The one-command demo (
docker compose up) seeds itself through the Management API (demo/seed.sh) instead of copying the pre-SQLite JSON files that 0.14 deprecates.
Fixed¶
- Kubernetes Services named like QueryAPIGate's settings no longer break it. Kubernetes injects
<SERVICE>_PORT=tcp://...into every pod for each Service, so a Service namedqueryapigate-eventssetQUERYAPIGATE_EVENTS_PORTand the server refused to start (and a Service namedqueryapigatebroke every CLI command, which readQUERYAPIGATE_PORTwhile parsing arguments). Such a value is now ignored with a warning naming the cause. - A table-restricted key sees only its tables in the schema.
allowed_tablesrefused statements on other tables, but the schema browser and MCP'slist_tablesstill listed every table and column on the connection, andtable_ddlshowed any table'sCREATE TABLE. Now the others are left out (and a foreign key pointing at one shows as none), andtable_ddlanswers a forbidden table with the same404as a missing one. - An empty
allowed_ipslist allows no address."allowed_ips": []on a key or role used to mean "no restriction" - failing open, unlike an emptyallowed_tablesorallowed_write_ops, which allow nothing.nullis still how to say "any address"; the Console sendsnullfor an empty field, as before. queryapigate eventsstreams can be read by every HTTP client. Its responses were delimited only by the connection closing, so some clients - Python'srequests, reading withiter_content(chunk_size=None)- received nothing until the stream ended. They now use HTTP/1.1 chunked encoding, asGET /eventson the main server already did.- The Docker image includes every optional feature the documentation describes: DuckDB (a tier 1 database),
allowed_tables(sqlglot - a table-restricted key's queries failed with500in the image), the Redis response cache,queryapigate mcpand MongoDB. Only H2 and generic JDBC still need the-h2variant, for its Java runtime. The image is about 90 MB larger. - No "experimental" warning for an inactive connection.
queryapigate initseeds an inactive H2 template, so every fresh server warned about H2 connections nobody used. - Browser pages can read every header the API sends them. CORS responses now also expose
X-RateLimit-Key-Limit/-Remaining(a key's own rate limit),X-Cache,ETag,DeprecationandLink- before, a page's JavaScript couldn't see them. - A server with no API key says so in its log at startup, wherever it runs - before, only
queryapigate serveon a non-local address warned, so a Docker container started withoutQUERYAPIGATE_API_KEYwas open with nothing in its log to say so (the Console'sopen_serveralert did). - SQL sent to a MongoDB connection is refused clearly -
400 wrong_connection_type, pointing to/execute_mongo- on/execute_sql, streamed exports and MCP'sexecute_sql. It used to fail inside the driver lookup, as a500whose detail was just'mongo'.
0.13.0 - 2026-10-04¶
The Console replaces /ui, the Management API (/api/v1) replaces the unversioned management routes, and every
front door - REST, MCP, live events - now shares one set of rules, one error format and one run history.
Upgrading from 0.12¶
Read these first; everything else in this release is additive.
- Breaking: the unversioned management routes are removed - use /api/v1. The table under Removed maps each
one to its successor. Runtime routes (/q/<name>, /execute_sql, /catalog, /events, ...) are unchanged.
- /ui redirects to /console, the new admin UI. It needs a browser from 2024 or later (Chrome and Edge 128,
Firefox 126, Safari 17.5).
- New versions of a saved query are drafts until published; only the published version is served. Existing
queries are published at their newest version on first start, so nothing callers see changes.
- MCP calls count against rate limits (QUERYAPIGATE_RATE_LIMIT and the key's own rate_limit) like REST
requests: an agent calling faster than its key allows now gets a rate-limit error.
- A saved query's own LIMIT is respected: paging no longer overrides it.
- An unreachable database answers 502 connection_failed, not 500 query_failed.
- Error bodies gain code and request_id beside error - additive; branch on code from now on.
- The store is upgraded to schema 5 on first start - back up QUERYAPIGATE_HOME (or the PostgreSQL store) first.
Startup now refuses a store with a missing column, or one a newer release already upgraded, with a message saying
what to do.
Added¶
- QueryAPIGate Console, at
/console- the admin UI. It replaces/ui(ADR 0001). Built with React + TypeScript infrontend/, it is a client of the public JSON API only, and looks exactly like/ui: the same stylesheet, sidebar, header, search and API key panel (the key is shared with/docsin the same browser tab). It has every screen/uihad (below). The wheel and the Docker image include the built Console, so running it needs no Node.js; a source checkout without a build shows how to build it. The Console is served with a strict Content-Security-Policy, and loading its static files doesn't count towardQUERYAPIGATE_RATE_LIMIT. GET /health's response is now described in the OpenAPI document (status,version).-
Drafts and publishing for saved queries. Each query now has at most one published version, which is the only one served (
/q/<name>, MCP, catalog,/openapi.json, Postman, bundle export,queryapigate export). Newer versions are drafts: only the admin key can run them, by number, to test before publishing; other keys get the same 404 as for a version that doesn't exist. Rolling back means publishing an older version.GET /list_filesshowspublished_version. See Drafts and publishing. -
Management API v1:
/api/v1/queries(ADR 0001, BACKLOG #72). A versioned, resource-oriented interface for saved queries: - list, filter, create, add a version (a draft unless published), publish, roll back, unpublish and delete;
- change a query's collection or a version's cache TTL;
- page through a query's run history;
- validate a definition without saving it.
Also GET /api/v1/connections and GET /api/v1/connections/{name}/schema. Every error carries a stable code
and the request_id; edits honour If-Match against the query's ETag (412 when it changed meanwhile); every
request and response is described in full in /openapi.json, and the tests validate real responses against it.
See Management API (v1).
- The Console's API Repository (/console/queries), rebuilt on the Management API and identical in look and
feel to the classic one. The Console now uses the classic UI's own stylesheet, sidebar, header, Ctrl K search,
API key panel, drawers and toasts (ADR 0001, "Visual parity"). What it has:
- the list (filter, Type/Host/Database filters, Collections/Queries, Postman, Rename);
- the detail panel: versions, meta, stat tiles, the requests-per-day chart, and the Run, SQL, History, Curl,
API Keys, Roles, Access, Cache, Metrics and CLI tabs;
- the New API, New version, Move, New collection and Rename collection drawers.
Drafts and publishing appear in the classic style: a Published / Draft / Previous pill; Publish, Roll back to and Unpublish buttons; and Save as draft next to Save in the drawer (Save still publishes at once, as before). The SQL editor is CodeMirror with completion that knows the connection's tables and columns, styled as the classic editor. The API Repository loads on first visit, so the shell stays light.
- The Console's API Designer (
/console/designer), rebuilt at visual parity with the classic one. It has: - the Type → Host → Connection → Database picker, with the connection's live usage;
- the SQL editor (CodeMirror, with completion that knows the dialect, tables and columns), run with Ctrl+Enter;
- Explain, and double-click a
column = literalto Parameterize it; - the sidebar's Recent Queries (shared with
/uiin the same tab), Settings (bound parameters, page, page size, timeout) and Schema, behind the draggable splitter; - the schema browser's starter query, preview,
CREATE TABLEand "used by" drawers; - the quick-stats strip, the results panel (with Copy as curl and Chart), and Save as New API (with Save as draft).
The API Repository drawer's schema browser regains its 👁 "preview in API Designer". The Designer keeps its query
while you visit other screens, as the classic tab always did. GET /api/v1/connections/{name}/schema gains
?database= for the Database picker.
- Management API:
/api/v1/connections, complete: - list (now with user, timestamps and live usage), create, get, change and delete (a reason is required, and kept in the audit log);
- the deleted list, test a connection, and list a server's databases.
PATCH merges: fields it doesn't mention are kept, driver options included. (The legacy PATCH /connections
replaces the whole record, so a form save could drop options and the example flag.) Passwords are masked in
every response and audited only as "changed"; edits honour If-Match. A connection that can't be reached is a 502
connection_failed with the driver's (redacted) message in detail.
- The Console's Connections screen (/console/connections), at visual parity with the classic one. It has the
All / Active / Inactive / Deleted segments, the filter, the table with live usage, and the New / Edit drawer
(password reveal, Load databases…, Test connection). Delete asks for a reason and the name typed back. Query opens
the API Designer on that connection.
- Management API: /api/v1/api-keys and /api/v1/roles: list, create, get, change and delete. A new key's
secret is in the create response only (sent with Cache-Control: no-store), never in a read or the audit log. A
key can be created from a role, and a role reports how many keys were created from it. Edits honour If-Match;
null clears an optional field, and active: false revokes a key.
- The Console's API keys and Roles screens (/console/api-keys, /console/roles), at visual parity with the
classic ones: both tables, the key drawer (Create from a role, the grant fields, Expires, Active), the one-time
secret reveal, the role drawer and "New key from this". The API Repository's API Keys and Roles tabs now edit in
the Console.
- Management API: /api/v1/history and /api/v1/audit. The first searches every saved query's runs, with
the same filters and cursor paging as GET /history. The second lists administrative changes newest first, with
filters, and says how many entries are stored and how many the log keeps.
- The Console's Metrics and Audit log screens (/console/metrics, /console/audit-log), at visual parity with
the classic ones. Metrics has the stat tiles (the two pool tiles live every 2 s), requests by status, queries by
connection and the per-connection table. Audit log has the action filter, the text filter, Refresh and Export.
- Management API: /api/v1/settings, /api/v1/mcp/status and /api/v1/mcp/tools: the server's configuration
by section (secrets never exported), the MCP port check, and the tools an MCP client sees.
- The Console's Settings screen (/console/settings), at visual parity with the classic one: every section,
Copy as .env, the MCP section's Check now and Tools, and the Interface preferences (theme, table density, default
result format). A preference changed in either UI applies to both, and now takes effect in the Console at once.
- The Console now has every screen of the classic UI. Home (now the screen it opens on), Caching, the Access map and Help join the others, at visual parity:
- Home: the stat tiles, System health, Recent activity, Quick actions, and Recent API requests / Slowest queries,
kept live from
GET /events; - Caching: the cache's numbers, the queries with a
cache_ttl, and the live cache entries, each viewable as a caller receives it; - Access map: every query against every key and role, with the connection → table drill-down, filters, search and sortable columns, and each query's details;
- Help: the quick reference and the docs browser (this project's markdown, read from GitHub at the running version).
The Console no longer sends you to /ui for anything.
- Management API: /api/v1/cache/entries (list, read, evict, clear); GET
/api/v1/queries/{name}/versions/{version}/flow (the tables and joins a version touches - the successor of
GET /query_flow); and on saved queries, created_at, last_used_at and cache_ttl in summaries and
run_count per version.
- Management API:
/api/v1/collections(list, rename, Postman export) and/api/v1/examples(status, install, remove). The Console now calls only the Management API and the runtime routes. - End-to-end tests of the Console (
frontend/e2e/, Playwright): every screen and the main flows, in Chromium against a real server, in CI on every push. - Ad-hoc SQL runs are recorded in run history and live events (BACKLOG #62):
POST /execute_sql,POST /execute_mongoand MCP'sexecute_sql, with the caller,transport(rest/mcp), connection, SQL, parameter names (never values), rows, duration and status.GET /api/v1/history?kind=saved|adhocseparates them; live events carry them asadhoc_execution; the Console's Home shows them. New settings:QUERYAPIGATE_HISTORY_ADHOC_LIMIT(default 1000) andQUERYAPIGATE_HISTORY_ADHOC_SQL(text,hashornone). Saved-query runs now recordtransporttoo. See Ad-hoc runs. queryapigate exportruns are recorded in run history, bykey_namecli. The CLI stays outside grants and rate limits: it is a local operator with the store's files already in reach.- A light/dark switch in the Console's top right corner. It sets the same Theme preference as Settings › Appearance (which is where to go back to following the operating system), and is remembered in this browser.
- A font size preference in the Console: Small, Medium (the default) or Large, in the top right corner beside the light/dark switch and under Settings › Appearance (the section was called Interface). It scales the whole page, text and spacing together, and is remembered in this browser.
- Times in the Console follow the viewer. Settings › Appearance › Time zone shows every timestamp in this
computer's time zone (the default), UTC, or the server's; Time format shows them as a date and time or as "5 min
ago". Hovering any time shows it exactly, with its zone. Before, timestamps were the server's local time with no
zone, wrong by the difference for anyone elsewhere.
GET /healthnow reports the server's zone (time_zone,utc_offset) so clients can convert too. - Settings › Editor & results (with Default result format, moved from Appearance): rows per page to start with,
NULL shown as
NULLor blank, thousands separators in result grids, and line wrapping and line numbers in the SQL editor. Settings › Appearance › Reduce motion turns off sliding drawers and pulsing indicators, and is on whenever the operating system asks for less motion. - Help in the Console: How-to guides have a tab of their own, next to Docs; both show an "On this page" list of the open page's sections, marking the one being read, and a doc's own links to its sections now work. Opening Help collapses the sidebar for room (your saved sidebar choice is kept for every other screen).
- Alerts: what needs attention now.
GET /api/v1/alertslists live conditions, most severe first: a server with no API key, failing connections, keys expired, expiring within 7 days or long unused, saved queries failing often, timing out or typically slow, keys and clients that keep hitting their rate limit, and run history that can't be written. Each says what to do and where, and clears by itself once its cause does. The Console has an Alerts screen (Observability) with All and a tab per check (/alerts/slow-queries, ...), each saying what it watches, a bell with a count in its header, and Home's System health now shows the same list. Dismissing an alert hides it in that browser until it clears. New settingsQUERYAPIGATE_ALERT_ERROR_RATEandQUERYAPIGATE_ALERT_KEY_UNUSED_DAYS; a query is slow byQUERYAPIGATE_SLOW_QUERY_THRESHOLD. See Alerts. - New screenshots of every Console screen in the README, including Alerts, Access map, Settings, Help and the dark
theme - taken by
frontend/scripts/screenshots.mjs(npm run screenshots) from a seeded throwaway server. queryapigate mcpserves its ownGET /metricsandGET /healthbeside/mcp.- One error format everywhere (BACKLOG #69). Every error response - the runtime routes (
/q/<name>,/execute_sql,/catalog, ...) as well as/api/v1andqueryapigate events- now carries a stablecodeand therequest_id, beside the existingerrorand extras. MCP tool errors carryerrorandcodeinstructuredContent. Failed runs keep theircodein run history. Every code is listed in Errors and covered by the compatibility promise; a test fails if a code is raised but undocumented, or documented but never raised. Additive for the runtime routes:error,detail,errorsand the HTTP statuses are unchanged. - The upgrade guarantee is tested (BACKLOG #65): stores built by released 0.7.1, 0.8.0, 0.9.0, 0.10.0, 0.11.0
and 0.12.0, and by this release, through their own APIs (
tests/fixtures/stores/) are started under the current code on every CI run, which must read back their connections, queries and versions, run history, keys and roles, and run the query. Each release adds its fixture. - ADR 0002: event ids (BACKLOG #59, the storage decision). Event ids
stay history row ids for now and are documented as opaque, increasing integers; a future event log continues
their sequence, so a client's
Last-Event-IDsurvives that upgrade.
Changed¶
- MCP calls are governed exactly like REST requests (BACKLOG #61). They now count against
QUERYAPIGATE_RATE_LIMIT(checked before authentication) and the caller's ownrate_limitgrant, appear in/metrics(methodMCP, endpointmcp.saved_query,mcp.execute_sqlormcp.list_tables), and accept a signed-in user'sAuthorization: Bearertoken, sofrom_claimqueries work for an agent acting for a user. REST, MCP andqueryapigate eventsshare one implementation (queryapigate/governance.py). Behaviour change: an agent that called faster than its key'srate_limitnow gets a rate-limit error. See Governance. - More specific
/api/v1error codes. Some errors that had only their status's code now have their own:admin_only(wasforbidden),invalid_bodyfor an invalid query definition andinvalid_filterfor a bad history/audit filter (both wereinvalid_request),connection_not_found,version_not_foundand others. Creating an API key, role or collection whose name is taken is always409. - The metadata store moves to schema 5, on first start, from a store any earlier release created:
- schema 4 adds
saved_queries.published_version: every existing query is published at its newest version, so nothing a caller sees changes. Deleting a query's published version publishes the newest older one, never a draft; - schema 5 lets
execution_historyhold ad-hoc runs (query_nameandversionmay be NULL). On SQLite the table is rebuilt, keeping every run and its id (live events' resume ids).
Back up first: going back to 0.12 on an upgraded store is not supported. migrate-to-postgres needs a store at
schema 5 - start this version on it once.
- Startup refuses a store it can't safely run on, with a message naming the problem and what to do, instead of
starting and failing on first use: a table missing a column this version needs, or a store a newer release has
already upgraded (which used to have its schema version silently written back down).
- The Console's Connections table shows Edit and Delete as icons (a pencil, and a red trash can), each with a
tooltip naming the connection, leaving room for more columns.
- /ui redirects to /console. The hand-written admin page it served (queryapigate/ui.py) is removed; the
Console has every screen it had, and looks the same.
Removed¶
- Breaking: the unversioned management routes are gone; use
/api/v1. Every one had a Management API successor first, and nothing in QueryAPIGate calls them any more; removing them before 1.0 keeps them out of the 1.x contract. The runtime routes (/q/<name>,/execute_sql,/execute_mongo,/execute_sql_from_file,/catalog,/events,/metrics,/health,/openapi.json) and schema browsing (/connections/<name>/schema,/table_ddl) are unchanged.
| Removed | Use instead |
|---|---|
GET /list_files, GET /view_file_content, PATCH /save_sql_to_file, DELETE /saved_sql/{name}, PUT /saved_sql/{name}/collection, PUT /saved_sql/{name}/cache_ttl, GET /query_flow |
/api/v1/queries and its versions (a new version is a draft unless saved with "publish": true) |
GET/PATCH /connections, DELETE /connections/{name}, POST /connections/test, POST /connections/databases |
/api/v1/connections |
/api_keys, /roles |
/api/v1/api-keys, /api/v1/roles (a new key's secret is secret, not key) |
GET /history, GET /audit_log |
/api/v1/history, /api/v1/audit (items, not entries) |
GET /settings, /settings/mcp_status, /settings/mcp_tools |
/api/v1/settings, /api/v1/mcp/status, /api/v1/mcp/tools |
/cache/entries, /collections, /examples |
/api/v1/cache/entries, /api/v1/collections, /api/v1/examples |
See Removed routes. The Postman collection in documentation/, the
how-to guides and the benchmarks use the new routes.
Fixed¶
- Creating a saved query in a collection through
/api/v1now records the collection in the audit log, as the old save route did - filing a query there grants it to every key on that collection. - Creating a connection through
/api/v1now closes idle pooled connections, as changing or deleting one does, so a name used before (deleted, then re-created) never reuses the old connection's sockets. - The audit log no longer shows
[object Object]for a grant like{"name": "films", "allow_writes": true}(a key or role with write access through a named query). It now shows the object as JSON. - A query's own
LIMITis respected (BACKLOG #74). Paging used to replace a trailingLIMIT/OFFSETwith the page window, so a saved "top 3" query (... LIMIT 3) returned a whole page: 10 rows by default, 50 with?page_size=50. Paging now happens within the statement's own window:LIMIT 3returns 3 rows, andLIMIT 25pages 10, 10 and 5, thenX-Has-More: false. This applies to/q/<name>,/execute_sql, MCP tools and the Console's Run tab. Also fixed in the same place: LIMIT :n(a bound parameter), a bareOFFSET mandFETCH FIRST n ROWS ONLYused to produce invalid SQL;- a comment after the
LIMIT(... LIMIT 3 -- top three) used to break the query.
Behaviour change: a client that relied on the page size overriding a saved query's LIMIT now gets the
query's own limit. Raise or remove the LIMIT in the query to get the old result.
- The Console's Theme preference took no effect: the built stylesheet followed the operating system's light or
dark setting whatever was chosen. The build now keeps the stylesheet's light-dark() colours as written, for
browsers from 2024 on (Chrome and Edge 123, Firefox 120, Safari 17.5).
- A database that can't be reached is reported as such: a run whose driver couldn't connect (refused,
unreachable, unknown host, timed out connecting) now fails with connection_failed and HTTP 502, not
query_failed and 500 - so callers, run history and the "connection failing" alert can tell it from SQL the
database rejected. The same for schema browsing.
- The Console's light/dark switch no longer shows a focus ring all the time.
- A store first created by 0.10 no longer breaks run history after upgrading. 0.10 created an
execution_history table in an early shape it never wrote to (its runs still lived in saved_sql/*.json), and
no later release replaced it, so recording or reading runs failed with no such column: entry_json. Startup now
replaces that empty table; one that somehow has rows stops startup with instructions rather than being dropped.
0.12.0 - 2026-10-03¶
Added¶
- Signed-in users (JWT).
Authorization: Bearer <token>is accepted as an alternative to an API key, verified against your identity provider's signing keys (QUERYAPIGATE_JWT_JWKS_URL, RS256, with mandatoryQUERYAPIGATE_JWT_ISSUER/QUERYAPIGATE_JWT_AUDIENCE) or a shared secret (QUERYAPIGATE_JWT_SECRET, HS256).expis required;noneand HMAC/public-key algorithm mixing are refused; JWKS keys are cached and refetched on rotation. What users may do comes from a role (QUERYAPIGATE_JWT_ROLE, or per user viaQUERYAPIGATE_JWT_ROLE_CLAIM), read live, its rate limit counted per user. Callers are namedjwt:<sub>(QUERYAPIGATE_JWT_USER_CLAIM) in logs, run history and live events - so each user's event stream, on both the main server andqueryapigate events, carries only their own runs;queryapigate eventscloses a stream when its token expires./metricscounts all signed-in users under onejwtlabel./openapi.jsongains aBearerAuthscheme. Unsafe settings stop startup. Needsqueryapigate[jwt](in the Docker image). from_claimparameter rule. A saved-query parameter can take its value from the caller's verified token -{"customer_id": {"from_claim": "sub"}}- so the query can only ever return that user's rows. Sending it is a 400, a token without the claim a 403, an API key other than admin a 403; it is left out of every caller-facing description (OpenAPI, catalog, Postman, MCP).queryapigate events: a live-events server for many clients. A separate asyncio process (no new dependency) servingGET /eventson its own port (QUERYAPIGATE_EVENTS_PORT, default 5002) to thousands of open streams - measured at 9,000 in one process, about 170 MB, every event reaching all of them within 0.75 s. Events come from run history in the store, so it sees every worker's and instance's runs: woken by a PostgreSQLNOTIFY(sent with each history batch) or checking everyQUERYAPIGATE_EVENTS_POLL_INTERVALseconds on SQLite. Each event carries its history id, and a client reconnecting withLast-Event-ID(or?last_event_id=) gets what it missed - filtered to its key - then the live stream, without gaps or repeats. Same key rules as the main server's/events(admin sees everything, other keys their own runs); a revoked or expired key's stream is closed within about a minute; a client that stops reading is disconnected so it can resume; a client that hangs up frees its slot at once.QUERYAPIGATE_EVENTS_MAX_CONNECTIONS(default 10,000) caps open streams;QUERYAPIGATE_RATE_LIMIT,QUERYAPIGATE_CORS_ORIGINSandQUERYAPIGATE_TRUST_PROXYapply. Deployment: a second service from the same image, with/eventsrouted to it (DEPLOYMENT.md section 9).- Batched run history. A saved-query run's history entry is queued in memory and written by a background
thread in one transaction per batch (
QUERYAPIGATE_HISTORY_FLUSH_INTERVAL, default 1 s;0restores writing inside the request), so a request never waits on it. A process always reads its own queued runs (they are written before any history read); other workers/instances see them within one interval. At most 10,000 runs are queued per process - beyond that new ones are dropped and counted rather than slowing requests. New/metrics:queryapigate_history_runs_total{outcome=recorded|sampled_out|dropped|failed}andqueryapigate_history_pending. - History retention and sampling.
QUERYAPIGATE_HISTORY_RETENTION_DAYSkeeps every run for that many days instead of each version's newest runs (a sweep every 10 minutes removes older ones) - meant for a PostgreSQL store.QUERYAPIGATE_HISTORY_SAMPLE_RATErecords only that fraction of successful runs; failed runs are always recorded.QUERYAPIGATE_HISTORY_LIMITmakes the per-version count (50) configurable. GET /history(admin): pages through every stored run, newest first, filtered by query, version, status, key and time range - for looking past the newest runs a list shows.- Settings screen: a Run history section for the four new variables.
- PostgreSQL as an optional metadata store (
QUERYAPIGATE_DATABASE_URL=postgresql://...). Connections, saved queries and their run history, API keys, roles and the audit log can live in a PostgreSQL database instead ofqueryapigate.db, so several instances can share one store - a key created or revoked through one is live on all of them at once. Unset (the default) keeps SQLite exactly as before. Needsqueryapigate[postgres](already in the Docker image). Tables are created on first start; writes that read before they modify are serialised with an advisory lock, giving the same guarantees SQLite's single write lock did. Legacy pre-SQLite JSON files are never imported into PostgreSQL. queryapigate migrate-to-postgrescopies an existingqueryapigate.dbinto the (empty) PostgreSQL database in one transaction, keeping history and audit-log order; it refuses, changing nothing, if the target already has data.--from PATHnames another file. The server logs a hint at startup when PostgreSQL is empty but the home folder still holds aqueryapigate.dbwith data.- The admin UI's Settings screen shows which metadata store is in use (password masked).
- CI runs the whole test suite a second time against PostgreSQL (
QUERYAPIGATE_TEST_DATABASE_URL, seetests/__init__.py).
Changed¶
- Lists (
/list_files, the admin UI) return a version's newestQUERYAPIGATE_HISTORY_LIMITruns however many are stored, so a long retention period never makes them larger. - Schema version 3:
execution_historygainsstatusandkey_namecolumns (copies of each run's own entry, soGET /historycan filter on them on both backends) and an index onexecuted_at. Added and backfilled automatically on first start;migrate-to-postgresneeds its source at version 3, i.e. started once with this release. - Saved-query calls by a scoped key no longer receive the database's own error text. A failed
GET/POST /q/<name>(or/execute_sql_from_file) made with any key other than the admin key now returns only{"error": "An error occurred while executing the SQL query"}- thedetailfield is dropped, since a driver message can name tables, columns, constraints or row values to a caller who didn't write the SQL and can't fix it. The full message is still in the server log under the same request ID. The admin key keepsdetail, and so does/execute_sqlfor every key (its caller wrote the SQL). Breaking for a client that readdetailfrom a saved-query error with a scoped key.
Fixed¶
- Read-your-writes for run history could miss a batch still being written (from the batched history in this release): a read checked only whether the queue was empty, and the writer empties it before writing - so a read in that window went ahead before the batch committed. It now waits while anything queued is unwritten. Seen as intermittent failures of history-reading tests on PostgreSQL.
- A connection's audit entry no longer reports the store's own
updated_atas a change. It appeared whenever two saves fell in different seconds, and an unchanged re-save a second later produced an empty update entry. - The main server's
GET /eventscan no longer starve it of request threads. Each open stream holds a thread, so a handful of clients could leave none for anything else (8 froze the Docker image's single worker entirely). At mostQUERYAPIGATE_EVENTS_MAX_STREAMS(default 4) are now held at once; beyond that it answers503withRetry-Afterand points toqueryapigate events.0turns it off. - A malformed JSON body on an endpoint whose body is optional (
POST /q/<name>) is now a 400 (Request body is not valid JSON). It used to be silently treated as no body at all, so a typo turned into a misleading<param> is required- or, for a query whose parameters all have defaults, a successful run with none of the values the caller sent. - An
intparameter outside the signed 64-bit range is now a 400 (must be a 64-bit integer) naming the parameter, instead of a 500 raised from inside the database driver.
Performance¶
- Recording a run's history no longer holds the store's write lock while it trims older entries - the
insert and the trim are separate transactions. On PostgreSQL, history writes also skip the store-wide lock
and the WAL flush wait (the durability SQLite's
synchronous=NORMALalready gives), so concurrent runs across workers and instances don't queue behind one another. - API-key authentication is one indexed lookup, no longer a scan of every stored key: per-request cost stayed flat as keys were added (measured: 64 ms per request with 10,000 keys before, unaffected after).
- Running a saved query no longer loads its execution history (up to 50 rows per version, each JSON-decoded) only to ignore it.
- The home directory path is resolved once, not on every metadata-store access (several per request).
- The metadata store uses
PRAGMA synchronous=NORMAL, SQLite's recommended setting under WAL: the file still can't be corrupted, but the history row every saved-query run commits no longer waits on an fsync. A power loss (not a process crash) can now lose the last few commits.
0.11.0 - 2026-10-01¶
Added¶
- The admin UI's Help > Docs browser now lists the
how-to/guides too, under a new "How-to guides" section beneath the existing "Reference" docs - the same fetch-from-GitHub-at-the-running-version's-tag mechanism already used for README/API/MCP/etc., no new plumbing.DOCSentries gained agroupfield; the nav now renders a small section label whenever the group changes. Verified rendering for a real how-to guide (headings, code blocks, links) with the fetch stubbed locally, sincehow-to/isn't pushed to GitHub yet. queryapigate examples loadnow prints a ready-to-run SSE example too, alongside the existing curl example -curl -N http://127.0.0.1:5000/events -H 'X-API-Key: ...'- so the live-events feature (see below) is discoverable the same way the REST endpoint already was, not just something you'd find by reading the docs. Verified: the printed command really receives a live event when a query runs in another terminal.GET /events(live SSE feed) opened to any authenticated key, each getting its own personal activity feed - previously admin-only, broadcasting every execution to that one connection. A scoped key can now connect and receives only executions it triggered itself (broadcast.Broadcastergained a per-subscriberkey_namefilter); the admin key's subscription is unchanged, still seeing everything. Documented for the first time - see API.md. Verified: two scoped keys running the same saved query each see only their own event; the admin key still sees both.- Two ad-hoc MCP tools,
list_tablesandexecute_sql, alongside the existing per-saved-query tools - schema discovery and read-only ad-hoc SQL for an agent, gated by the sameconnectionsgrant REST's own/connections/<name>/schemaand/execute_sqlalready check, reusing their exact permission checks and execution code.execute_sqlis always forced read-only over MCP regardless of the calling key's ownallow_writesgrant, and still honors a key'sallowed_tablesrestriction if it has one. Verified end-to-end against a real running MCP server with a real client: tool listing, schema discovery, a real query, a refused write, and a refused unauthorized connection. See documentation/MCP.md. outputSchema/structuredContentfor every MCP tool - a generic result-envelope schema ({"rows": [...], "truncated": bool}for a saved query orexecute_sql;{"tables": [...], "truncated": bool}forlist_tables), not per-column, since a saved query's actual columns are only known once it runs. Verified round-tripping through the realmcpSDK's own client, not just this project's own dict shape. Breaking, per this release's own new versioning policy above, if you already call an MCP tool and parse its result text: a row-returning tool's text content used to be a bare JSON array with an ad-hoc"(truncated to N rows)"suffix string when capped; it is now always the wrapped{"rows": [...], "truncated": bool}object (or readstructuredContentdirectly instead of parsing text at all). Themcpextra's floor moves tomcp>=1.10(from>=1.9) - that's where the SDK's ownoutputSchema/structuredContentsupport landed.- Two on-demand MCP panels in the admin UI's Settings > MCP server section: a "Reachability" check
(
GET /settings/mcp_status, a plain TCP connect attempt againstQUERYAPIGATE_MCP_PORT, only ever run on an explicit "Check now" click - never automatically, preserving this project's original reasoning against probing a separate process on every settings load) and a "Tools" panel (GET /settings/mcp_tools) listing every tooltools/listcurrently returns for an unrestricted caller, computed in-process so it works whether or notqueryapigate mcpis actually running. Verified live against a real running MCP server in both the reachable and unreachable states. - A real versioning and compatibility policy (see the "Versioning and compatibility" section above), replacing a bare "we use SemVer" line: what's covered by the version number, what isn't, and this project's pre-1.0 rule that only a minor release - never a patch - may carry a breaking change, always flagged as one. CONTRIBUTING.md and DEPLOYMENT.md's upgrade guidance now point at it instead of restating it.
documentation/THREAT_MODEL.md- a threat model and security architecture reference, distinct from SECURITY.md's operational checklist: what's actually at risk, who might attack it, and how each existing control (auth, the scoped-key grant model, the SQL guard's real limitations including a documented past bypass, secrets at rest, rate limiting, audit logging) works and where it stops. Linked from SECURITY.md, README's security section, the mkdocs nav, and the admin UI's new Docs browser (see below).- A "Docs" tab inside Help, open by default and sized to fill the window (the same full-width treatment
the API Designer's Run tab already gets), a real in-app browser over this project's markdown docs (README,
Installation, API Reference, Production Deployment, MCP Server, Examples, Security) - a sidebar list on the
left, rendered markdown (headings, tables, code blocks, links) on the right. Since
documentation/*.mdisn't shipped in the pip package or the Docker image, each doc is fetched client-side straight from GitHub at the tag matching the server's own running version, falling back tomainif that tag isn't published (e.g. a dev build) - so what's shown always matches, or is newer than, what's actually running, never older and never wrong for the installed version. Markdown is rendered with marked.js, loaded lazily from a CDN on first open, the same CDN-script pattern the existing/docs(Swagger UI) page already uses. - A fuller Help screen. New "Where to find things" card explains the sidebar's Data/API/Access/Observability groups in one place; "Concepts" now covers the response cache and CLI export; "Resources" links the production Docker deployment guide and the MCP server docs, neither of which was linked from the admin UI anywhere before.
- A CLI tab on the API Repository screen, next to Metrics. Shows the
queryapigate exportcommand for that specific saved query - the one CLI command that's actually about a specific query (the cron/systemd/Kubernetes CronJob path, running in-process againstQUERYAPIGATE_HOMEwith no server or API key needed) - with a Copy button. A declared parameter with a default becomes its real value; one without becomes a<placeholder>to fill in, exactly the same convention the existing Curl tab already uses, off the same parameter source, so the two never disagree about what a query's parameters are.
Fixed¶
pip install -e ".[dev]"was broken on Python 3.9, failing CI on every matrix job at that version. Thedevextra unconditionally pulled inqueryapigate[mcp], but themcppackage itself requires Python ≥3.10 - pip's resolver had no compatible version to install and failed before anything else ran.queryapigate[mcp]indevnow carries apython_version>='3.10'marker, so it's simply skipped on 3.9 (matching howmcp_server.py's own imports are already deferred andtest_mcp.py's SDK-dependent tests already skip without the package) rather than breaking the install for every other dependency too. Verified against a real Python 3.9 container:pip install -e ".[dev]",ruff,mypyand the full test suite (906 tests) all pass.
Added¶
documentation/DEPLOYMENT.md: a production Docker deployment guide, distinct from the repo-rootdocker-compose.yml(a one-command, localhost-only demo). Covers pinning a real image tag, a production compose file (reverse proxy/TLS via Caddy, secrets in.env, resource limits), backups (queryapigate.dbis SQLite in WAL mode - the published image has nosqlite3CLI, so the guide uses Python's own backup API instead), Prometheus/Grafana wiring, the optional Redis-backed cache, and why the image runs one gunicorn worker rather than a replica count. Every command in it was run against the real published image while writing it - including a real ordering bug this caught: runningqueryapigate initviadocker compose execafterupwrites the template connections file, but they don't actually appear until the container restarts, sinceservealready initialized an emptyqueryapigate.dbfirst; the guide has readers runinitbefore the firstupinstead, which sidesteps it entirely.- Three API Designer improvements, addressing the screen feeling sparse compared to API Repository:
- A connection context strip under the Type/Host/Connection bar - active/inactive, host/database, and the same live usage summary (queries/failed/avg latency) the Connections tab's own table shows per row.
- A per-run quick-stats strip pinned right after the editor (status, rows, duration, format, and the widest column on the page) - stays visible without scrolling past a long results table.
- The Recent Queries side tab now shows each past run's outcome (rows, duration, or "failed (4xx/5xx)") under its SQL, not just the query text.
Changed¶
- "Save as New API" no longer leaves API Designer. It used to navigate to API Repository and open the side drawer; now a compact form opens in a box right below the SQL editor, on the same screen, with the connection and query text read live from the editor above at save time (not frozen into the form) so editing the query with the form open just works.
- Merged Home's "Recent API requests" and "Slowest queries" into one box with Recent/Slowest tabs, instead of two separate panels - same underlying data (execution_history), shown two ways.
Added¶
- Type/Host/Database filters on the API Repository screen. Three cascading dropdowns above the Collections/Queries list (same cascading idea as API Designer's own Type → Host → Connection picker) narrow the list to queries saved against a matching connection - a collection with nothing left after filtering just disappears rather than showing up empty. Combines with the existing name/description/tag text search.
- A cache-entries browser on the Caching screen. Lists every live response-cache entry (query, version,
connection, format, content type, size, TTL remaining) for whichever backend is configured - in-process or
Redis, both now implementing the same
list_entries()/get_body()/delete()/clear()shape. A "Preview" action opens the exact cached response body, served with its real content type, through the same result renderer API Designer's own Run tab already uses - not a bespoke viewer. Per-entry delete and a "Clear cache" action, both admin-only and unaudited (cache housekeeping, not a configuration change). New routes:GET/DELETE /cache/entries,GET/DELETE /cache/entries/{key}. Scoped deliberately to what QueryAPIGate itself put in the cache (qag:cache:*), not a general Redis key browser - Redis here is an internal cache implementation detail, not a modeled connection. - Real-time connection-pool numbers on Home and Metrics.
pool.pygained anactive_count()alongside the existingidle_count()(a newqueryapigate_pool_active_connectionsgauge, next toqueryapigate_pool_idle_connections) - the pool tracked idle connections only before, with no visibility into how many are checked out right now. Both tiles carry a small pulsing "live" indicator and refresh every 2 seconds via a light, targeted poll (just these two numbers, not a full metrics reload) whenever the Home or Metrics tab is visible. - Three new benchmark scripts (BACKLOG #25):
benchmarks/latency.py,pooling.py,caching.py, alongside the existing buffered-vs-streamedrun.py, sharing new common plumbing inbenchmarks/common.py.latency.pymeasures p50/p95/p99 for a smallGET /q/<name>/POST /execute_sqlcall against a fixed 100-row table, isolating queryapigate's own overhead from query execution time.pooling.pymeasures throughput/latency and the idle-pool hit rate as concurrent callers increase relative toQUERYAPIGATE_POOL_SIZE- and documents a real finding along the way:pool.pyonly bounds idle connections, not concurrent ones, so there is no bounded-pool "wait time" to measure the way a traditional pool would have.caching.pymeasures the real hit-vs-miss latency delta for acache_ttl-carrying saved query, classified by the response's ownX-Cacheheader. Real runs committed for MySQL and ClickHouse (seebenchmarks/README.md); the other four dialects are a follow-up.
Changed¶
- Renamed the "Saved queries" and "Run SQL" admin UI sections to "API Repository" and "API Designer"
- the sidebar nav, breadcrumb, page heading, Home stat tile, quick actions, Ctrl-K search group, and every
button/hint/tooltip that names the section (e.g. "New saved query" → "New API", "Open in Saved queries" →
"Open in API Repository"). Scoped to UI chrome only: internal ids (
data-tab="queries"/"run"), routes (/q/<name>), JSON field names, CLI output, and the generic noun "a saved query" used elsewhere in hints and docs are all unchanged. - Regrouped the admin UI sidebar: API Repository and API Designer moved out of "Data" into their own new "API" section; Caching moved from "Observability" into "Data", alongside Connections.
- Collapsed-sidebar nav items now show an inline SVG icon instead of a two-letter abbreviation (e.g. "Sq"/"Rn" → a house for Home, a key for API keys, a shield for Roles, ...). Self-contained, no icon font or external library - matches the page's existing "no build step, no external script" design.
Added¶
- The admin UI's Settings screen now has an "MCP server" section (BACKLOG #54), showing
QUERYAPIGATE_MCP_PORT/QUERYAPIGATE_MCP_MAX_ROWSin the same read-only "effective value and whether it's the default" shape as every other setting.queryapigate mcp(BACKLOG #42) is a separate process, so this is configuration only, not a live health check - the section says so plainly rather than showing a status dot that would just be guessing whether that other process is actually up. - Example API keys and seeded request history for
queryapigate examples load(BACKLOG #27). Loading the example APIs now also creates one real API key per role (reporting/dashboard/export/partner/executive) and seeds each freshly-loaded query with realistic-lookingexecution_history, so the admin UI's History tab, Home tab and requests-per-day chart show real data immediately instead of staying empty until someone actually calls a query. This is a deliberate reversal of examples.py's previous "no key is created" design - the server now requires authentication for every request the moment these keys exist, not just the example endpoints. Each key's secret is shown exactly once (printed by the CLI, returned byPOST /examples, or logged once at startup forQUERYAPIGATE_LOAD_EXAMPLES) and is never recoverable after that. The seeded history is real, persistedexecution_historyvia the same function a real request already uses; the in-memory/metricscounters and the API Keys/Connections "Usage" columns are deliberately not seeded, since those are documented as live-traffic-only and reset on every restart. README's Quick Start now setsQUERYAPIGATE_API_KEYfrom the start, since none of the example keys can run ad-hoc SQL and the server no longer stays open by default. - Table access restrictions for API keys/roles,
allowed_tables(BACKLOG #21's remaining gap). A key or role can now be narrowed to a specific set of tables it may query -mysql,postgres,clickhouse,sqliteandduckdbconnections only, the dialectssqlglot(already an optional dependency, theflowextra) can parse for this. Unlikeallowed_write_ops, this restricts every statement, read or write. Checked against every table a query actually touches - joins, subqueries, CTEs (a CTE's own name is never mistaken for a real table) and the target table of a bareDELETE/UPDATE/INSERTare all resolved correctly. A table-restricted key used against anh2/jdbc/mongoconnection is refused on every query with a clear403, never silently left unrestricted, since those dialects can't be verified. New "Allowed tables" fields on the API Keys/Roles forms, and a table-count badge on the Access column. - An MCP server exposing read-only saved queries as tools (BACKLOG #42).
queryapigate mcp(needspip install "queryapigate[mcp]", Python >= 3.10) starts an MCP server on its own port (QUERYAPIGATE_MCP_PORT, default 5001), separate fromqueryapigate serve- MCP's Streamable HTTP transport is ASGI, this app is WSGI, so the two run as separate processes against the sameQUERYAPIGATE_HOMErather than being bridged into one.tools/listreuses the exact sameapikeys.can_run_saved()scopingGET /catalogalready enforces, computed fresh per request (never cached - two different API keys reach different queries);tools/callruns a query through the exact samerun_saved()the REST API uses via a synthetic Flask request context, so caching,execution_history, audit logging and the Home tab's live feed (BACKLOG #43) all fire exactly as they do over REST - no parallel execution path. Only read-only saved queries (SELECT/WITH/SHOW/DESCRIBE/EXPLAIN, and any Mongofind()) become tools in this version; a write-capable query stays reachable over REST as before, since exposing it over MCP needs adestructiveHintclassification and a confirmation-flow decision this codebase doesn't make yet. A tool call's result is capped atQUERYAPIGATE_MCP_MAX_ROWS(default 200), independent of the REST API's own page-size default, since an LLM's context can't hold a large result. - Live updates for the admin UI's Home tab via Server-Sent Events (BACKLOG #43). The "Recent API
requests"/"Slowest queries" panels used to poll
GET /list_files(the whole saved-queries catalog) every 5 seconds while Home was visible. A newGET /events(admin only) now pushes onedata: {...}line per saved-query execution as it's recorded, and the panels patch themselves in place instead of refetching - updates now arrive in well under a second instead of up to 5. Backed by a new in-processBroadcaster(queryapigate/broadcast.py), one instance per Flask app, with the same swappable-backend shapecache.py/rediscache.pyalready established for the response cache, so a future Redis-pub/sub variant (for a multi-instance deployment) is a clean addition later, not a rewrite - not built yet, since nothing needs it under the documented single-process deployment. The client reads the stream withfetch()'s streamed response body rather than a plainnew EventSource(...), sinceEventSourcecannot set theX-API-Keyheader every other admin request already uses, and putting the key in the URL instead would leak it into logs and browser history. Falls back to the old 5s poll if the stream can't be reached or drops, so a live-feed failure never means the panel just stops updating. --worker-class gthreadadded to the Dockerfile's gunicorn command (and the example command indocumentation/INSTALLATION_AND_SETUP.md), found necessary while building the above: gunicorn's defaultsyncworker class ignores--threadsentirely, so the image's existing--threads 8was silently inert - undersync, the single worker handles one connection at a time, and a long-lived/eventsconnection would have blocked every other request to the server for as long as that one client stayed connected. Verified against a real container: a held-open/eventsconnection no longer delays a concurrent/healthrequest.
Changed¶
- API keys, roles and the audit log now live in
queryapigate.db(SQLite), notapi_keys.json/roles.json/audit_log.json(BACKLOG #53, Phase 2 - completes the JSON-to-SQLite migration Phase 1 started for connections and saved queries). Every publicapikeys.py/store.record_audit()/read_audit_log()function kept its exact name, signature and return shape, so no other module needed to change.create_key/update_key/delete_key/create_role/update_role/delete_rolenow read-check- write against real SQL rows inside a transaction instead of rewriting a whole JSON file; the audit log's "keep the newest N entries" cap is now a per-insert indexed trim (the same technique Phase 1 already gaveexecution_history) instead of a whole-file read/append/rewrite.rename_collection()andexamples load/unloadkeep their existing resumable-not-atomic design exactly as before (both are explicitly documented and tested that way, andexamples loadalso writes a real on-disk SQLite file mid-sequence that no transaction could roll back anyway) - what changed is only that each step inside them now writes to SQLite instead of a JSON file. Pre-existingapi_keys.json/roles.json/audit_log.jsonare imported automatically, once, the first time their table is empty - nothing to run by hand, and the JSON files are never consulted again afterward. Every persistent store this app owns is now SQLite-backed with real cross-process transactions;--workers 1is still the recommendation, now because the built-in rate limiter and in-memory/metricsare per-process state, not because any file needs an in-process lock.
0.10.0 - 2026-09-29¶
Added¶
- A "requests per day" chart below the meta row (BACKLOG #52). The saved-query detail view now shows a
daily request-count column chart right under the connection/collection/author/modified row, visible on
every subtab. Zero-filled from the first to the last day in the selected version's
execution_history- a quiet day is a real zero bar, not a gap - with the tallest day direct-labelled and every bar carrying an exact date/count tooltip. No new fetch. - A per-query Metrics tab (BACKLOG #51). Right after Cache, showing that version's own run stats -
total runs, success rate, avg/slowest duration, avg rows, last run, and a "Runs by caller" chart when
more than one key has called it - aggregated entirely from
execution_historyalready on the client, no new fetch. ReusesrenderMetrics()'s ownstatTile()/barCard()building blocks. - A tables/joins flow diagram on the SQL tab (BACKLOG #50). The saved-query SQL tab now shows the same
"Query flow" diagram the Access tab does - tables and their join edges, flowing into the query - minus
the keys/roles column, since this tab is about the query's own structure, not who can reach it. Shares
the same cached
/query_flowfetch, so it's instant if the Access tab already loaded it. - A per-query Cache tab (BACKLOG #49). The saved-query detail view gets a new "Cache" tab, right after
Access, showing and editing that version's
cache_ttl- an on/off toggle plus a TTL field, saved via a newPUT /saved_sql/<name>/cache_ttl(admin only). Editing it is not a new version, the same way moving a query's collection already isn't - no version bump, noexecution_historyentry, takes effect on the very next request. - A Caching screen (BACKLOG #48). A new "Caching" tab (next to Metrics) shows the response cache's
backend (in-process or Redis, from
/settings), live entry/hit/miss counts and hit rate (two new/metricscounters,queryapigate_cache_hits_total/queryapigate_cache_misses_total, plus aqueryapigate_cache_entriesgauge - counted from theX-Cacheheader responses already carry, no changes to the cache lookup/store paths themselves), and a table of every saved query that declares acache_ttl. The Saved queries detail view also gets a "Cached · Ns" chip next to the existing version/latest/status ones, on any query with acache_ttlset. - A shared, Redis-backed response cache (BACKLOG #47). Setting
QUERYAPIGATE_REDIS_URLswaps the in-processcache_ttlcache for a Redis-backed one (pip install "queryapigate[redis]") that survives a restart and is shared across horizontally-scaled instances - useful when a hot OLTP query is hit hundreds of times a second. Unset means today's behavior, byte-for-byte unchanged. A cache failure is always treated as a miss/no-op, never a request failure. Does not change the documented--workers 1recommendation for the file-based store - see the correction added to BACKLOG #43. - A per-table reach indicator in Run SQL's Schema browser (BACKLOG #46). Each table now shows the same
Q/C/W badge the Access map uses - green means at least one API key or role can reach a query touching
this table, a muted dot means only the admin key can, and no badge at all means no saved query touches it.
Clicking it opens a panel listing which queries touch the table and who can reach them, with a "View in
Access map" link straight into the fuller screen. Built entirely by reusing the Access map's own
machinery (
getQueryFlow(),queryReach()) - one pass over the connection's queries per Schema-tab paint, not one lookup per table, so browsing a connection's schema now costs about what clicking one table in the Access map already cost today, computed once and shared across every table shown. Only wired into Run SQL's own schema browser, same reason as the DDL icon (#38) - the saved-query form's embedded schema browser already lives inside the shared drawer this needs. The panel now also shows each touching query's actual, formatted SQL (not just its name), in a wider drawer to fit it comfortably. Also fixes a race where the Schema browser's very first paint could run before the saved-queries list finished loading, permanently caching an empty usage index for that connection until a manual refresh. - A "show CREATE TABLE" icon in the schema browser (BACKLOG #38). A new ⌸ icon next to the existing
⧉/👁 ones shows a table's real DDL (
GET /connections/{name}/table_ddl) formysql,sqliteandclickhouseconnections - SQLite's is free (sqlite_master.sqlalready is the CREATE TABLE text), MySQL/ClickHouse each have a singleSHOW CREATE TABLEstatement. Postgres has no single-statement DDL dump (real reconstruction frompg_catalogwould be its own follow-up); H2/DuckDB are left out the same way they were for the PK/FK work (#37) - unverified completeness in this environment; Mongo has no DDL at all. Safe against a malicious table name by construction: the requested name must already be a table the connection's own schema listing reported before any DDL query is ever built, since no driver supports parameter-binding for an identifier the way it does for a value. Only wired into Run SQL's schema browser, not the saved-query form's embedded one, since that one already lives inside the shared drawer this feature also needs. - BACKLOG #45 finished: three more zero-cost reuses of already-loaded data, and one corrected note.
A new "Slowest queries" panel on Home, ranking the same
execution_historydata Recent API requests already shows byduration_msinstead of time. A role with zero keys created from it now renders dimmed in both the Roles table and a saved query's Roles tab, instead of a plain "0" easy to miss. The schema browser's "copy starter query" icon now generates a realJOIN(with real table aliases, collision-safe even for a self-referencing foreign key) when a table has foreign keys, instead of always a bareSELECT * FROM table- a table with no foreign keys is completely unchanged. "Empty collections," the fourth item #45 originally listed, turned out not to apply to this app's data model - a collection is a derived property of the queries filed under it, not a standalone entity, so there's no such state to flag. - Two zero-cost reuses of already-loaded data (BACKLOG #45). Table-scoped autocomplete now shows a
→ tablehint (full detail on hover) next to a foreign-key column, using the same schema data the schema browser's PK/FK badges (#37) already carry. The API Keys table now highlights a key expiring within 7 days (not just an already-expired one), reusing theisKeyExpiringSoon()check added for Home's health panel (#44). - A "System health" panel and three more stat tiles on the Home tab (BACKLOG #44). Active queries, pool idle connections and rate-limit rejections join the existing stat tiles - the same numbers the Metrics tab already computes, just not previously shown on Home. The new health panel flags expired and soon-to-expire (within 7 days) API keys and any connection with recorded errors, each clickable straight to the relevant tab; shows "No issues detected" when clean, since that's a real health signal too. No new fetch, no new metric - every figure was already loaded somewhere on the page.
- A "Recent API requests" panel on the Home tab, auto-refreshing every 5 seconds. A live-ish tail of
saved-query runs (newest first: time, query, connection, caller, rows, duration), built from the same
execution_historythe per-query History tab already shows, just aggregated across every saved query. Auto-refreshes only while Home is the visible tab, via a lightweightGET /list_filespoll - not the full Saved Queries screen's own load path. Click a query name to jump straight to its History tab. Only saved-query runs through/q/<name>are recorded this way - ad-hoc Run SQL calls have no saved query to attach a history entry to, so they don't appear here, and the panel says so plainly when empty. - The example database grows from 3 tables to 8 (BACKLOG #27). New
category,store,staff,addressandpaymenttables, each with a real foreign key (exceptcategory, a deliberate plain lookup table joined into nothing), generated purely additively -film/customer/rental's own rows are untouched, and their generation order is unchanged, so this doesn't affect anything already built on them.example_all_rentals(the export scenario) now joins six tables -rental,film,customer,payment,staff,store-paymentis exactly 1:1 withrentalby construction, so the row count stays exactlyRENTAL_COUNT, same as before. Gives the schema browser's PK/FK badges and the Access tab's Query flow diagram real, richer data to show. - A fifth example role,
example-executive(BACKLOG #27), spanning two collections at once. Read-only,300/hour, granted bothexamples-reportingandexamples-dashboard- the one thing none of the four existing example scenarios showed on its own: a role (and so a key created from it) reaching more than one collection.documentation/EXAMPLES.mdalso now points at the newer schema/parsing features using the existing example data - PK/FK badges onrental's real foreign keys, the Access tab's Query flow diagram on a real joined query, table-scoped autocomplete, and real SQL pretty-printing. Also fixes the admin UI's "Example APIs are loaded" strip, which hardcoded "four roles" and was about to be wrong the moment a fifth role existed. - A Home tab for the admin UI. A new first tab (ahead of Connections) - an at-a-glance overview: connection/saved-query/API-key/role counts, requests and error rate, the 5 most recent audit log entries (click one to jump to its likely tab), and quick actions (Run SQL, New saved query, New connection, Help). Built entirely from caches the other tabs already load - no new endpoint - and re-rendered from the tail of each of those loaders so it's never stale regardless of load order. Becomes the default landing tab for a fresh session; a returning user's last-used tab (remembered per browser tab) still takes over as before.
- Real SQL parsing for the Access tab's "Query flow" panel (BACKLOG #40). A new
queryapigate/sqlflow.pyparses a saved query's SQL withsqlglot(newflowextra) and extracts the tables and joins it touches (GET /query_flow). Supportsmysql,postgres,clickhouse,sqliteandduckdbconnections;h2/jdbc/mongo(and any query sqlglot can't parse) get a plain explanatory message instead - this never touches the execution or write-guard path, and a parse failure never blocks or raises. The Query flow panel shows this as a real node-link diagram - tables (with join edges) flowing into the query, flowing out to the keys/roles that can call it - built from plain HTML nodes plus a thin SVG line layer, no new charting dependency. - The Access map's own "which queries reference this table" filter now uses that same real parsing where the connection's dialect supports it, falling back to the original text-search heuristic per-query when it doesn't (h2/jdbc/mongo, or an unparseable query) - fixes false positives like a table name only appearing in a SQL comment.
- The SQL tab and the Access map's query info popup now show a real
sqlglotpretty-print of a one-line saved query when the dialect supports it, in place offormatSql()'s naive token reflow (still the fallback for unsupported dialects, unparseable queries, and any query using the legacy{name}brace placeholder, whichsqlglotdoesn't understand). Note this can cosmetically normalize the SQL text itself, not just its layout - e.g. an implicitorders oalias becomes explicitorders AS o, and a--line comment becomes/* */- both still exactly equivalent, valid SQL. - Table-scoped column autocomplete (BACKLOG #39, table-scoped slice). Typing
alias.ortable.in either SQL editor (Run SQL, or the saved-query form) now pops up that table's columns, filtered as you keep typing, accepted with Enter/Tab/click, dismissed with Escape/click-away. Uses a lightweightFROM/JOINregex to resolve the alias (notsqlflow.py's real parser, which needs finished SQL, not text that's routinely mid-keystroke) and the existing schema cache for columns - no new backend work. No suggestion for an alias that doesn't resolve, and none at all for a Mongo connection's JSON editor. - Primary/foreign key markers in the schema browser's Columns tab (BACKLOG #37). A column now shows a
"PK" badge and a "FK → table.column" badge when it's part of one, for
mysql,postgres,sqliteandduckdbconnections. A new, additive_KEY_QUERIESper dialect (schema.py) merges onto the existing schema fetch and degrades gracefully - a permissions error or unexpected catalogue shape just means no badges, never a broken schema fetch.h2(unverifiable in this environment) andclickhouse(no real foreign-key concept) are explicit gaps, not bugs; a composite key reports only its first column.
Changed¶
- Connections and saved queries now live in
queryapigate.db(SQLite), notdb_connections.json/saved_sql/*.json(BACKLOG #53) - Phase 1 of moving off hand-rolled JSON file storage (API keys, roles and the audit log are unaffected for now, and stay JSON-backed for a later phase). Every publicstore.pyfunction kept its exact name, signature and return shape, so no other module needed to change; compound read-modify-write operations (saving a new version, moving a query between collections, trimmingexecution_historyto its last 50 runs) are now real, all-or-nothing SQL transactions instead of a whole-file rewrite under one coarse lock. Pre-existingdb_connections.json/saved_sql/*.jsonare imported automatically, once, the first time the relevant table is empty - nothing to run by hand, and the JSON files are never consulted again afterward.GET /view_file_content(the admin UI's "Show raw file" toggle) still returns the identical JSON text a saved-query file always looked like, reconstructed from SQLite.QUERYAPIGATE_HOMEnow needs to be writable (previously only needed to be readable) - the bundleddocker-compose.ymldemo, whose data folder was mounted read-only, now seeds a proper writable volume from it via a small one-shot init container instead.
0.9.0 - 2026-09-28¶
Added¶
- MongoDB support (find-only). A new
mongoconnection type; ad-hocfind()queries from Run SQL andPOST /execute_mongo; saved Mongo queries (query_type: "mongo") exposed throughGET/POST /q/{name}exactly like a saved SQL query, including OpenAPI//cataloglisting, bundle export/import and:namebound parameters (substituted as real JSON values viamongotools.fill_placeholders(), not string splicing); collection listing in the Schema tab; native database listing/switching. Read-only, full stop - there is no write path at all yet (see BACKLOG #36 for the deliberately-deferred remainder: aggregation pipelines, writes, per-field schema sampling, caching, streaming and a dedicated query-builder UI - v1 uses one JSON textarea,{"collection", "filter", "projection", "sort"}, in both Run SQL and the saved-query form). A$where/$function/$accumulatorfilter is rejected outright (arbitrary server-side JavaScript execution), the Mongo equivalent of the SQL guard's read-only/single-statement check. - Run SQL's sidebar redesign: Recent/Settings/Schema tabs instead of one long stacked column, a draggable splitter between the editor and the sidebar (width remembered across sessions), the redundant Table dropdown removed now that the Schema tab already inserts a table on click, and the schema browser capped with its own scrollbar instead of growing unbounded for a connection with a lot of tables. Editing an existing mysql/postgres/clickhouse(/mongo) connection now loads its database list automatically instead of waiting for a manual click, and the tab drops its usual width cap so the editor and results fill the whole window on wide screens.
- A "Test connection" button on the New/Edit connection form, and
POST /connections/test(admin only): tries to actually connect with the fields on screen - not yet saved - so a typo'd host or a firewalled port is found out before saving, not on the query that comes after. Never touches the connection pool's saved state or writes anything; a driver's own error text is redacted before being shown, so a real password can never leak back through a connection error. - Connections now record when they were created and last edited (
created_at/updated_at, shown as new columns in the Connections table and in the Edit form). Server-controlled - a client cannot fake either one by echoing them back. A connection saved before this existed shows—until its next edit. - The Access map's UI improvements from this cycle, listed together here: quick-glance Database/Created/ Last modified/Last used/Version columns, an info popup per query (with its pretty-printed SQL), sortable columns, Database/Reach filters, a combined API-keys-and-roles matrix, and a Connection-to-table drill-down that shows which tables a connection's saved queries actually expose (with a shortcut to draft a new saved query on one that isn't exposed yet).
- Run SQL's connection picker is now Type → Host → Connection instead of one flat name list - at more than a handful of connections, "which of these is the one I want" is a type-and-host question first.
- The schema browser is now Tables and Columns tabs instead of an expand/collapse tree: clicking a
table jumps straight to its Columns (name and type, with its own scrollbar for a table with a lot of
them), and a copy icon per table builds a starter query into the editor without running it - a full
SELECT(every column by name, one per line, schema-qualifiedFROM,ORDER BYthe first column,LIMIT 100) for SQL, or the equivalentfind()document for mongo. The editor grows to fit whatever it pastes in instead of clipping it behind a scrollbar. The preview icon is now an eye rather than a play triangle, next to the copy icon at the end of the row. - A "Save as New API" button in Run SQL: opens the same "New saved query" form the Saved Queries screen has, pre-filled with the query you just tried there, its connection, and an empty entry per detected bound parameter - test it first, then save it, rather than writing a saved query blind.
- Double-click a column (or its comparison value) in Run SQL to turn it into a bound parameter: a
popover previews the exact edit (
customer_id = 5→customer_id = :customer_id) before anything changes, and confirming fills Bound Parameters with the real, correctly-typed value automatically. - Saved Queries is now Collections and Queries tabs, mirroring the schema browser, instead of one long expand/collapse list per collection; the search box still spans every collection at once regardless of which tab is open.
- Run SQL's Recent Queries/Settings/Schema tabs are a consistent size regardless of which is open - previously the whole row resized depending on which tab's own content happened to be tallest - and each now scrolls internally for its own overflow, the way Schema already did. "Recent" is renamed "Recent Queries", and Schema is now the tab shown by default.
- The Access map's Reach column moved next to Connection instead of last; clicking a query's name there now opens it directly in Saved Queries. A saved query's own "who can reach this" panel shows the same Q/C/W reach badges inline per key and role now, instead of a plain comma-separated name list, with a "View in Access map" link for the full cross-query matrix.
- A Help screen (sidebar, below Settings): getting-started steps, keyboard shortcuts, a short concepts glossary (saved query, collection, key vs. role, Q/C/W reach, bound parameters) and links to the docs site, GitHub repo, issues and changelog.
0.8.0 - 2026-09-26¶
Added¶
- A redesigned admin UI. The tab bar is now a collapsible left sidebar grouped into Data, Access and Observability
(
Ctrl/Cmd+Btoggles it, and the choice is remembered), with a breadcrumb in the top bar. API docs, OpenAPI and the API key panel live at the foot of the sidebar; every screen has a title with a one-line description; Connections has All / Active / Inactive tabs; and a global search (Ctrl/Cmd+K) jumps to any connection, saved query, API key or role. Metrics shows bar rows instead of charts, the audit log can be exported as JSON, and the first saved query opens by default with only its collection expanded. - A read-only Settings screen and
GET /settings(admin only): every environment variable the server reads, its effective value and whether it was set or is the built-in default, with a "Copy as .env" button. A secret (the admin key, the encryption key) is only ever reported as configured or not - never returned, and never copied. - Interface preferences in Settings: theme (system, light, dark), table density and the default result format. They live in the browser only and are never sent to the server.
0.7.1 - 2026-09-26¶
Fixed¶
- The container crashed at startup with
QUERYAPIGATE_LOAD_EXAMPLES=yeswhen its data folder was not writable (for example a-v "$PWD/data:/data"folder that Docker had created, which is owned by root while the container runs as a non-root user). SQLite's own error escaped the examples loader, the worker died and gunicorn kept restarting it. Loading the examples is a convenience, so a failure now only logs a warning saying the folder must be writable, and the server starts;queryapigate examples loadprints the same message instead of a traceback. The previous test for this mocked the wrong error type; the new ones use a genuinely read-only folder.
Changed¶
- README: the Docker examples now use a named volume (
-v queryapigate-data:/data), which works without any host permission setup, and explain what a host folder needs (writable by uid 1000).
0.7.0 - 2026-09-26¶
Changed¶
- License: from MIT to the Functional Source License, Version 1.1, MIT Future License (
FSL-1.1-MIT). QueryAPIGate is now source-available rather than open source. You can still use, modify and redistribute it for any purpose except a Competing Use - offering it to others in a commercial product or service that substitutes for it or offers substantially similar functionality (so: not selling it, or hosting it as a paid service). Running it inside your company, non-commercial education and research, and professional services for a licensee are all permitted. Each version becomes MIT on the second anniversary of its release. Versions 0.4.0 through 0.6.1 were released under MIT; they are no longer distributed, and a copy already obtained under MIT stays under those terms. The code is unchanged in this release; only the license and its metadata are (LICENSE, the package'sLicense-Expression, the container image label, the README). Outside code contributions are not being accepted for now (CONTRIBUTING.md).
Removed¶
- The Sakila and Chinook sample SQLite databases and the
examples/folder that held them (with their two saved queries and the licence notices those datasets need). They were never part of the wheel; the repository now has no third-party data. Usequeryapigate examples loadfor a working sample instead - its data is generated locally. The Docker demo's film titles (which came from Sakila) are replaced with generated ones, and the documentation's examples now use the generatedexamplesconnection (filmtable) instead of theactortable. The repository history was also reset to a single commit for this release, so earlier commits and releases are no longer published.
[0.6.1] - 2026-09-25¶
A small fix; no behaviour change beyond it. Nothing to do when upgrading from 0.6.0.
Fixed¶
- A key's
last_used_atwas not recorded for its first use when the host had booted less than 60 seconds earlier: the "never recorded" state was0.0, compared againsttime.monotonic()(which counts from boot on Linux), so the first use fell inside the throttle window and was skipped. Only a machine that had just booted was affected, which in practice meant freshly created CI runners - it made the CI test job fail on a random subset of Python versions on every run. Fixed by treating "never recorded" as absent, with a regression test on a simulated freshly-booted clock.
[0.6.0] - 2026-09-25¶
Upgrade recommended: this release fixes a security issue in scoped API keys (see Fixed). Adds collections,
example APIs, a Postman export and caller-supplied request IDs. Stored keys, roles and saved queries from 0.5.0 work
unchanged. One behaviour change comes from the fix: a key granted a saved query (or collection) can no longer point it
at a different connection with ?connection_name= unless it also holds a grant on that connection - a client that
relied on doing so needs that connection added to its key.
Added¶
- Collections (#35): a saved query can belong to one named collection, stored on the query
file itself. A key or role can be granted a
collectionslist - read-only, additive, live (it reaches whatever is in the collection now and later), with no"*"wildcard and no write access through it. Newly granted names must exist. New:PUT /saved_sql/<name>/collection(move; audited with the keys and roles that gain or lose access),GET /collections(queries, keys and roles per collection, including a grant whose collection has emptied),PATCH /collections/<name>(rename - resumable, never narrows access part-way;mergefor an existing target), andqueryapigate collection export|import(portable bundle of definitions only; validated like saving a query, all-or-nothing before writing,--on-conflict fail|skip|new-version,--dry-run).collectionis also accepted byPATCH /save_sql_to_fileand reported byGET /list_filesandGET /catalog. The admin UI groups the Saved Queries list by collection, adds Move… with a who-gains/loses-access preview, rename, and a Collections field on the key and role forms. - Example APIs (#27):
queryapigate examples load | unload | statusinstalls four worked scenarios - reporting, dashboard (cached 30 s), streaming export and partner integration - as 11 saved queries in four collections, four matching roles, and anexamplesconnection to a ~2 MB SQLite database generated locally (no third-party data shipped). Everything is markedexampleand removal deletes exactly that; loading refuses, changing nothing, if something of yours holds an example's name. Idempotent.QUERYAPIGATE_LOAD_EXAMPLES=yesloads them at startup (for containers; a problem is a warning, a malformed value is rejected).GET/POST/DELETE /examples, a Load / Remove control in the admin UI, and a walkthrough indocumentation/EXAMPLES.md. No API key is created. - Postman export of a collection:
GET /collections/<name>/postman,queryapigate collection export --format postman, and a Postman button in the admin UI. OneGET /q/<name>request per query with its parameters filled in from their own rules (a test runs every generated example back through the server's parameter validation); authentication is an empty{{apiKey}}variable, so the file never holds a key. Export only, and a snapshot. - New collection in the admin UI: pick a name and the queries to file under it, with the who-gains/loses-access preview.
- Caller-supplied
X-Request-Id: send your own (1-64 characters of letters, digits,.,_,:,-- a UUID works) and it is used in the response header, the log lines and a saved query's run history, so a run can be tied to a trace in your own system. Anything else is ignored and the server generates its own, as before; it is a correlation aid only and nothing authorises by it. Matched withfullmatch, so a trailing newline cannot smuggle a forged log line in. - A test that every route appears in the OpenAPI document.
Fixed¶
- Admin UI: at widths between about 1240 and 1320 px the last tab (Run SQL) was clipped now that tabs carry counts - the compact two-row header now starts below 1360 px. Collection group headers in the Saved Queries list no longer truncate a collection's name behind their own controls.
X-Request-Idwas not in the CORS exposed headers, so a browser page on another origin could not read the ID the server returned; it is now exposed (and allowed on requests).- A key granted a saved query (
queries) could run that query's SQL against any connection by adding?connection_name=<other>(orconnection_namein a POST body), even withconnections: []. Aqueriesorcollectionsgrant now authorises the query only on its own connection; another one needs a real connection grant. Anyone relying on scoped external keys should upgrade.
Changed¶
- One function (
apikeys.can_run_saved()) now decides whether a caller can reach a saved query for/openapi.jsonand/catalog(previously the same rule was written out separately in each), saved-query validation is shared by saving and importing, and a query's effective parameters are derived in one place for OpenAPI, the catalogue and the Postman export.
[0.5.0] - 2026-09-25¶
Changed¶
- Breaking: renamed from SQL2API to QueryAPIGate. A clean break with no compatibility aliases, so an
existing deployment must change these before upgrading (full table and rationale in that release's
documentation/INSTALLATION_AND_SETUP.md):
the PyPI package is
queryapigate(wassql2api), the command isqueryapigate(wassql2api), the Python package isqueryapigate, environment variables areQUERYAPIGATE_*(wereSQL2API_*), Prometheus metrics arequeryapigate_*(weresql2api_*), the Docker image isghcr.io/anantharajuc/queryapigate, and the JSON logloggerfield and the admin UI's browser-storage keys use the new name. Data files (db_connections.json,saved_sql/,api_keys.json, ...) are unchanged. Because an unset API key means an open server, the oldSQL2API_*variables are not merely ignored: a server that still finds any of them in its environment refuses to start and names each one to rename, rather than silently running unprotected. To migrate environment files in place:sed -i 's/SQL2API_/QUERYAPIGATE_/g' <file>; the same substitution withsql2api_->queryapigate_fixes Prometheus queries and alert rules. Releases 0.1.0 through 0.4.0 below shipped assql2apiand are described under that name. This is the first release published under the new name.
Added¶
queryapigate export <query> --out <path>(closing #31): runs a saved query and writes its full result to a file, entirely in-process againstQUERYAPIGATE_HOME- no server needs to be running, no HTTP round trip, no API key. Built for cron/systemd/Kubernetes CronJob to call, deliberately not a scheduler itself.{name}/{date}placeholders in--out;--format csv|tsv|ndjson(the same formats?stream=truesupports, via the same underlying code path -formats.iter_stream_chunks(), newly factored out ofstream_response()so both share it);--connectionoverrides the saved query's own default;--param name=value(repeatable) supplies a required parameter. Writes to a temp file and renames into place only on success, so a failed run never leaves a partial file at the final path; exits non-zero on any failure so cron's own failure handling works unmodified. See Scheduled exports to a file.- Configurable, exportable audit log retention (closing #30):
QUERYAPIGATE_AUDIT_LOG_LIMITreplaces the hardcoded 500-entry cap onaudit_log.json(validated at startup, following the same patternQUERYAPIGATE_STREAM_MAX_ROWSalready uses - always a positive count, never "unbounded", since the file is read and rewritten in full on every audit event).QUERYAPIGATE_AUDIT_LOG_EXPORT_FILE, when set, also appends every entry to a separate, never-capped, never-rewritten file (one JSON object per line) - for retention a rolling cap can never satisfy, independent of the primary write so a problem with one never blocks the other. See Audit log. - Package metadata for PyPI discoverability (closing #28):
DocumentationandRepositorylinks in[project.urls](PyPI's sidebar renders both as clickable links; onlyHomepage/Issues/Changelogwere set before), andEnvironment :: Web Environment,Operating System :: OS Independentand per-versionProgramming Language :: Python :: 3.9..3.14classifiers matching the CI test matrix exactly (PyPI's "Programming Language" filter facet uses these). Deliberately does not add aTyping :: Typedclassifier or apy.typedmarker - the codebase is gradually typed formypy's own benefit (see[tool.mypy]'s comment), not annotated throughout, and that classifier is a PEP 561 promise to consumers this project doesn't actually keep yet. Verified withpython -m buildandtwine check dist/*, and by inspecting the built wheel's ownMETADATAfile. - Modernized
licenseinpyproject.tomlto a PEP 639 SPDX expression (license = "MIT", replacinglicense = { text = "MIT" }) and dropped the now-redundantLicense :: OSI Approved :: MIT Licenseclassifier -python -m buildwas warning that the classifier form is deprecated. The build now emitsLicense-Expression: MITand bundlesLICENSEunder the wheel's standardlicenses/directory automatically, with no change to what's actually licensed. - Live usage on the Connections and API Keys admin-UI screens (closing #32):
GET /connectionsandGET /api_keysnow carry ausageobject per entry (queries run, failures, rows returned - plus average latency for a connection) aggregated from the same in-process counters/metricsalready renders, via two newmetrics.summary_for_key()/metrics.summary_for_connection()functions. Previously that data existed only in Prometheus text form; a key or connection's row showed grants and, at best, a singlelast_used_attimestamp, with no way to see how much it had actually been used or how often it had failed without a separate/metricsscrape. See Connections and Authentication and permissions. - A saved query's History tab (closing #33) now shows
request_idandkey_namecolumns (execution_historyalready recorded both, added for the log-correlation work closing #19, but the admin UI never rendered either), plus a client-side status filter (all/success/failed) and a search box over connection, caller, request ID and error text. See Admin UI. - The Audit Log tab (closing #34) now has an action-type filter and a search box (actor, target, timestamp),
filtering client-side over what it already fetched, and a create/delete snapshot's
changesomits unset fields (null/""/[]) instead of always listing every field on the entity - a diff (an update) is unaffected, since it never had unset fields to begin with. See Audit log. GET /catalog(closing #26): every saved query a caller can reach, and the terms it's offered under -cache_ttl, whether that specific caller can write through it (per-query write curation may differ query to query), and the caller's own rate limit alongside the server-wide one. Assembled from data that already existed but was scattered across admin-only screens a scoped key can never reach; scoped by the same reachability rule/openapi.jsonalready uses, so a query a caller can't use is never listed. Newconfig.format_rate_limit()(the inverse ofparse_rate_limit()) renders a resolved(count, seconds)limit back into its human form, e.g."100/minute". See The API catalogue.- A Metrics tab in the admin UI (closing #29) and a pre-built Grafana dashboard
(
documentation/grafana-dashboard.json). The tab parses/metricsclient-side into stat tiles (requests, error rate, active queries, pool idle connections, rate-limit rejections, rows returned), two bar charts (requests by status, queries by connection) and a per-connection latency/error table - a live snapshot, deliberately with no history or trends, so a deployment with no Prometheus/Grafana stack still gets some visibility; needs no API key, since/metricsis already public. The dashboard is for deployments that do have that stack: request/query rate and latency (p50/p95/p99), error rate, rows returned, active queries, pool occupancy and rate-limit rejections, ready to import against a Prometheus scrape of/metrics. See Seeing it: a built-in view, or a real dashboard. - Refreshed admin UI screenshots in the README (Connections, Saved Queries, API Keys, Roles, Run SQL), plus new ones for a saved query's History tab, the Audit Log and the Metrics tab.
Fixed¶
- The admin UI header broke at common laptop widths once it reached eight tabs: tab labels wrapped onto two lines at 1280px, the API key bar's Apply button was clipped at the right edge, and between roughly 980px and 1200px the header overflowed and scrolled the whole page sideways. Labels no longer wrap, the key bar never shrinks, the tab row scrolls horizontally if it ever runs out of room, and below 1240px the tabs move onto their own row. Checked with no horizontal page scroll at every width from 390px to 1440px.
- The action and status dropdowns on the Audit Log and saved-query History filters stretched to the full row width, pushing the search box onto its own line; they now size to their content.
- The Connections, API Keys, Roles and Audit Log tables now scroll horizontally inside their panel on narrow screens instead of widening the whole page.
[0.4.0] - 2026-09-25¶
Added¶
- Named permission roles (closing #22): a role (
/roles, admin only) is a reusable template for a key'sconnections,allow_writes,queries,rate_limit,allowed_ipsandallowed_write_ops-POST /api_keyswith"role": "<name>"copies those fields onto the new key once, at creation. It's a template, not a live link: editing or deleting a role afterward never touches a key already created from it, sinceauthenticate()only ever reads the key's own stored entry. A key records which role it came from increated_from_role, purely informational.rolecan't be combined with an explicit grant field in the same request (400) -expires_atis the one exception, since it's inherently per-key rather than part of a shared template. Admin UI gained a Roles tab and a "Create from" picker in the New API key form. See Permission roles. - Encryption at rest for connection passwords (
SQL2API_SECRET_KEY, closing out #24): a literal password is now encrypted with Fernet before it touches disk - existing connections immediately at startup, new ones the moment they're saved - and decrypted only in memory at the instant a connection is actually opened. Needs the new optionalsql2api[encryption]extra (bundled in[all]); a clear startup error names the missing package or a malformed key rather than a rawImportErroror silent failure. A${VAR}reference is untouched either way - never a secret stored in the file to begin with. An encrypted password masks the same as a literal one inGET /connectionsand the audit log; a missing or rotatedSQL2API_SECRET_KEYfails a request clearly (500, naming the problem) rather than passing ciphertext to the driver, and a startup warning fires if encrypted passwords exist on disk with no key configured to read them. See Encryption at rest. - Per-query write curation for API keys: a
queriesentry can now be{"name": ..., "allow_writes": true}instead of a plain name, granting write access to that one saved query specifically - on top of, never instead of, the key's blanketallow_writes. Lets a key haveconnections: []andallow_writes: falseyet still write through one curated endpoint (e.g.submit_order), the shape the external-clientqueriesgrant was originally built for but couldn't quite express. The"*"wildcard can never carry a write grant - wanting write access to a specific query means enumerating the wholequerieslist explicitly, the same explicit opt-in shapeallow_writesalready has everywhere else. Admin UI's saved-query checkbox grid gained a "write" checkbox per query. See Per-query write curation. - Finer-grained query governance, two of three gaps: an API key with write access can now be narrowed to
specific
allowed_write_ops(e.g.["insert", "update"]) rather than every write keyword being equally permitted onceallow_writesis on - checked insqltools.validate_sql(), never restricts a read-only statement. A newSQL2API_STREAM_MAX_ROWScaps a?stream=trueexport, which was previously unbounded regardless ofSQL2API_MAX_PAGE_SIZE; past the cap the export ends early, aWARNINGis logged, andsql2api_stream_exports_totalcounts it under a newstatus="truncated", distinct from"success". Admin UI's API Keys tab gained an "Allowed write operations" form field and shows a write-op count on the Access column. Table-level allow-listing (the third, hardest gap) remains open - it needs real SQL parsing, not the lightweight guard this project deliberately uses. See Write operation granularity and Streaming exports. - Structured per-query observability fields, second slice (SQL hash, serialization time): the per-query and
streaming-start log lines now carry a full SHA-256
sql_hashalongside the existing full SQL text, so a log aggregator can spot "did this same query run elsewhere/before" without storing or searching the SQL itself. Response body serialization (JSON/CSV/TSV/XML/YAML/XLSX encoding) is now timed separately from query execution - a newsql2api_serialization_duration_secondsmetric by output format, aserialization_msfield on the per-request access log line, and aserialization_msfield on a saved query'sexecution_historyentries alongside the existingduration_ms(query time) - so encoding cost (which can rival query time for XLSX or other large-page exports) is no longer invisible, folded into "whatever's left over" between total and query latency. Closes out #19 entirely. See Observability. - Structured per-query observability fields, first slice (query correlation): a saved query's
execution_historyentries now carryrequest_idandkey_name, so a slow or failed run visible in the admin UI's History tab can be traced back to the exact log line and caller that produced it. InSQL2API_JSON_LOGSmode, the per-query, streaming-start, slow-query and per-request access log lines now also carry their key fields (connection,dialect,limit/offset/timeout,duration_ms,method/path/status) as real top-level JSON keys viaextra={...}, not just folded intomessage- a log aggregator can filter or aggregate on them directly. See Observability. - Basic data visualization in the admin UI: a "Chart" toggle on any tabular result (Run SQL and saved-query
Run tabs) draws a quick bar chart of the current page, off by default. Deliberately scoped to the page on
screen, not the full result - a visible note says so, since
page_sizeis capped and a chart of one page of a much larger result could otherwise look complete without being one. Label/value columns are pickable; no charting library, inline SVG matching the editor's own no-dependency approach. - Audit logging for administrative actions (
GET /audit_log, admin only): a durable, capped record of every API key, connection and saved query created, changed or removed, distinct from live request/query observability. An update records a diff of only the fields that actually changed; a create or delete records a full snapshot instead. A connection's password is never a value in either form - masked as********in a snapshot, reported only as the literal string"changed"in a diff - and an API key's entry never includes its secret or hash. Admin UI gained an "Audit Log" tab. See Audit log. - A startup warning for connections storing a literal, non-empty password directly in
db_connections.jsoninstead of a${VAR}reference to an environment variable - names every affected connection in one line. Doesn't block startup or change stored data; a nudge toward the existing${VAR}convention, not new enforcement. See Connections. - Two new
/metricsseries:sql2api_rows_returned_total(rows actually returned, by connection, dialect and calling key - the trimmed page for a paged query, or however many rows made it out of a streaming export before it finished or failed partway through) andsql2api_active_queries(a gauge of queries currently executing, paged or mid-stream - for a streaming export this stays incremented for as long as the client keeps reading, since the connection stays checked out the whole time, not just for the initial dispatch). See Observability. - IP allowlisting per API key (
allowed_ips, a list of IP addresses or CIDR ranges - IPv4 or IPv6, mixed freely): real defense in depth for a key handed to an external party with known, stable infrastructure, since even a leaked key then only authenticates from an expected address. Checked inapikeys.authenticate()against the same client addressSQL2API_TRUST_PROXY/ProxyFixalready establish as trustworthy for rate limiting, not re-derived. Uses the stdlibipaddressmodule for parsing and containment - no new dependency. A request from outside the list fails exactly like a wrong key (401), not a distinct error. Restricts who may use a key at all, independent of per-key rate limiting (how much a caller who is already allowed may do); the admin key is never restricted by it.PATCH /api_keys/<name>with an explicit{"allowed_ips": null}clears an existing restriction, the same patternexpires_at/rate_limituse. Admin UI gained an "Allowed IPs" form field and an "IPs" table column. See IP allowlisting. - Per-key rate limiting (
rate_limit, e.g."100/minute"): an API key can now carry its own quota, checked in addition toSQL2API_RATE_LIMIT, never instead of it - so handing scoped keys to several external clients no longer means they all draw from one shared server-wide budget where a single noisy integration can exhaust it for everyone else. Applies even when the server-wide limit is unset entirely. Rejections from a key's own limit read{"error": "Rate limit exceeded for this API key", ...}, distinguishable from the server-wide rejection's plain"Rate limit exceeded", and surface their ownX-RateLimit-Key-Limit/X-RateLimit-Key-Remainingheaders alongside the existing server-wide pair.PATCH /api_keys/<name>with an explicit{"rate_limit": null}clears an existing per-key limit. Required a small architectural addition, not just a new field:RateLimiteronly ever enforces one(count, period)spec per instance (by design - it wipes every bucket when a different spec arrives, so an admin changingSQL2API_RATE_LIMITdoesn't mix old and new rules), so two keys with different limits need genuinely separate limiter instances - see the newratelimit.KeyRateLimiters, one instance per distinct spec actually in use, with keys sharing a spec correctly sharing an instance too. Admin UI gained a "Rate limit" field and table column. See Per-key rate limiting. - Per-key usage visibility (
last_used_at):GET /api_keysnow reports when a key last authenticated a request, so a stale key nobody has called in months is easy to spot, or a newly-issued external key's wiring can be confirmed. Updated at most once a minute per key (not on every single request, which for a busy key would turn every call into a disk write for no real benefit) - read it as "roughly how recently," not an exact timestamp. A never-used key simply has nolast_used_atfield. The admin UI's API Keys table gained a "Last used" column alongside "Created". See Last used. - API key expiry (
expires_at,YYYY-MM-DD): a key stops authenticating on its own once the date passes (valid through the end of that date), checked live on every request the same wayactivealready is - no background sweep, nothing to schedule or fail silently. For time-boxed access (a trial integration, a partner engagement with a known end date) without anyone having to remember to come back and revoke it.PATCH /api_keys/<name>with an explicit{"expires_at": null}clears an existing expiry without rotating the secret; omitting the field from aPATCHbody leaves whatever expiry a key already had untouched. The admin UI's API Keys form gained an "Expires" date field, and the table shows each key's expiry (or "never"), visually distinguishing an already-expired key from an active one. See Key expiry. - A "Curl" tab on each saved query in the admin UI, after Run/SQL/History: a ready-to-copy
curlcommand for that query'sGET /q/<name>endpoint, with each parameter that has no declared default shown as a readable<name>placeholder to fill in (not percent-encoded - built as a plain string rather than throughURL.href, which would otherwise turn<id>into%3Cid%3E) and the API key, if any, redacted to a placeholder rather than the session's real value, same policy as the Run SQL tab's own "Copy as curl". - Per-saved-query API key access (
queries): a key can now be scoped to a specific list of saved-query names, independent of and additive withconnections- so an external-client key can reach exactlymonthly_revenueand a handful of other approved queries, with no connection access of its own and no ad-hoc SQL access, while internal keys keep the existing coarser connection-wide grant unchanged.queriesmay also be"*"for every saved query by name without ad-hoc access, a middle tier between a single connection and full admin./openapi.json//docsnow reflect a key's actual reach - aqueries-scoped key sees only its own approved catalogue, not the full internal list of saved queries, closing a pre-existing gap where any authenticated key could see every saved query's name, description and parameters regardless of its own connection scope. Backward compatible: a key created before this field existed keeps behaving exactly as it did. See Per-saved-query access. - Streaming exports:
?stream=trueonPOST /execute_sqlandGET/POST /q/<name>(csv/tsv/ndjson only) streams the whole result straight from the database cursor instead of capping it atpage_size- always read-only regardless ofSQL2API_ALLOW_WRITES, since a large export has no business mutating data (this also sidesteps a lot of incidental complexity around commit timing on a connection held open for a long download). MySQL (an unbuffered cursor), PostgreSQL (a named, server-side cursor) and ClickHouse (execute_iter) stream without the driver buffering the whole result client-side first - verified end-to-end against real servers: 1 million rows streamed over real HTTP with the server process's own memory sampled throughout stayed flat (~49-55MB for MySQL/PostgreSQL), against several hundred MB fetching the same result the ordinary way. SQLite, H2, the genericjdbctype and DuckDB still bound this project's own memory to one batch at a time regardless of result size, even where the underlying engine or driver holds more than that internally (documented per-dialect, not assumed - see the_DuckDB/_H2/_Postgresdriver docstrings inrunners.py). A PostgreSQL-specific quirk only a real server surfaced: a named cursor'sexecute()is really aDECLARE CURSORunder the hood and does not run the query at all - column info and
statement_timeoutcancellation are only available after the first fetch, the reverse of every other driver here. See Streaming exports. - Generic DuckDB connections (
db: "duckdb") - opt-in viasql2api[duckdb], needing no external runtime (a native Python extension, like SQLite). One connection type covers two uses: a genuinely capable embedded database (database: <path>, same shape as SQLite) and querying CSV/JSON/Parquet files directly from a saved query's own SQL (SELECT * FROM read_csv(:path)), no import step or new connection fields. Schema introspection, pooling and the SQL guard's ANSI (quote-doubling) literal rules all apply unchanged. Two things a real DuckDB database surfaced that aren't in its docs: opening a second connection to a file with a different read-only setting than one already open on it in-process fails outright, so - likeh2/jdbc- every pooled connection here is opened read-write and the read-only guarantee rests on the SQL guard alone; and unlikeh2/jdbc, the query time limit is enforced, viaConnection.interrupt()on a background timer, since DuckDB's Python client (unlike JDBC through jaydebeapi) exposes a real cancellation hook. See DuckDB connections. - A show/hide toggle on the connection form's password field, in both create and edit mode - verified with a real headless-Chrome test that it doesn't disturb the existing password-mask round-trip.
- The Run SQL tab's stat bar now leads with the response's HTTP status code and status text (Postman-style "200 OK · 1 row · json · 8 ms"), accent-colored to read as success at a glance; the error path is unchanged. Verified with a real headless-Chrome test.
- The admin UI's Run SQL tab and New saved query drawer have a Schema panel next to the SQL editor: lists
the selected connection's tables, expands to show columns (type/nullability as a tooltip), and clicking a
table or column inserts its name at the cursor. Updates automatically when the connection changes; a
connection whose schema isn't available shows that message inline rather than through the page's error
banner. A thin client of the existing
GET /connections/<name>/schemaendpoint - no new backend logic. Verified end-to-end with a real headless Chrome (Playwright) test covering both mount points, expand/ collapse, click-to-insert for both tables and columns, connection-switch reactivity, the unsupported- dialect message, and the refresh button - zero uncaught JS errors. mypyruns in CI (gradual typing -[tool.mypy]inpyproject.toml; the codebase has no type hints yet, so it catches genuine static errors rather than demanding annotations everywhere). It found two real, if low-impact, issues fixed here:runners._Driver.DIALECTwas untyped, so mypy inferredNoneas its exact type and flagged every dialect subclass for assigning a string to it; andmetrics.py's module-level counters had no annotation for their (tuple key -> value) shape. mypy 2.x dropped support for running on Python 3.9 (Requires-Python >=3.10), so CI's 3.9 job resolves the last compatible 1.x release instead - which, it turned out, disagrees with 2.x about whetherignore_missing_importsalone covers a module that's installed but ships no type stubs (PyYAML'simport-untypederror, as opposed to one mypy can't find at all).disable_error_code = ["import-untyped"]covers it on both mypy generations.- Test coverage is measured in CI and uploaded to Codecov (a
badge is in the README) - currently 93% across
sql2api/from the unit test suite alone (not counting the real-database integration tests). - Python 3.14 added to the CI test matrix.
- Generic JDBC connections (
db: "jdbc") reach any database not covered by a dedicated driver - Oracle, SQL Server, DB2, Snowflake and others - by generalising the embedded-JVM approachh2already used. A connection needsjar(the vendor's driver jar),driver_classandjdbc_urlinstead ofhost/port/database; everything else (the SQL guard, parameter binding, pooling, output formats) is unchanged. Two limits are inherent to sharing one JVM per process, not specific to this connection type, and are documented in DATABASE_CONNECTION_CONFIGURATION.md:SQL2API_QUERY_TIMEOUTis not enforced (no portable way to cancel a statement across arbitrary JDBC drivers), and a newjdbcconnection whose jar was not already on the classpath when the JVM first started needs the server restarted before it can be used. Schema introspection (GET /connections/<name>/schema) answers 400 for this connection type rather than guessing at a vendor's system catalogue. Verified end-to-end against a real H2 server reached through the generic driver (not the dedicatedh2one) - connection pooling, bound parameters, client-side pagination (LIMIT/OFFSET is not portable SQL either, so it is no longer appended server-side for this type), the read-only guard, and the schema-browser boundary - plus the JVM classpath-union logic that lets an H2 and a jdbc connection share the one JVM regardless of which one is used first. - The admin UI (
/ui) has an API Keys tab: create, edit and revoke scoped API keys, matching the connections/saved-query tabs' style. A freshly created key's secret is shown once, with a copy button, the same one-time reveal the API itself enforces. A scoped (non-admin) key sees the same "only the admin key" message here as on the Connections and Saved Queries tabs. Verified end-to-end with a real headless Chrome browser: create, the secret-reveal, edit (including switching between the"*"wildcard and specific connections), revoke, and the admin-only empty state for a scoped key - zero uncaught JS errors across the whole flow. - Audit logging: log lines and
/metricsnow carry the name of the API key that made the request -adminforSQL2API_API_KEY, a scoped key's own name, or-when no key is configured at all. Distinguishingadminfrom-needed splitting what was one "no key configured" state into two inapikeys.Permission. Kept off the latency histograms so the number of keys never multiplies their bucketed output; requests and query counts still carry it. - Opt-in response caching for saved queries: set
cache_ttl(seconds) when saving one. A cache hit answers with the identical body andX-Cache: HIT(X-Cache: MISSon a fresh response), carriesETagandCache-Control: max-age=<cache_ttl>, and honoursIf-None-Matchwith a bodyless304. Never used for a saved query whose SQL is a write, regardless ofcache_ttl- serving a cached response in its place would silently skip that write - and a cache hit is not recorded inexecution_history, since nothing ran against the database. Verified against a real MySQL server, including that a cached write still runs on every call. - A documentation site (MkDocs, Material theme), built from this README and
documentation/- there is still exactly one place to edit each document;docs/only mirrors their paths so cross-links keep working. Deployed to GitHub Pages by.github/workflows/docs.ymlon every push tomainthat touches a doc file (needs a one-timeSettings -> Pages -> Source: GitHub Actionsfrom a repository admin). - Per-key API permissions:
SQL2API_API_KEYstays a full-access admin key, unchanged. New scoped keys (POST /api_keys, admin only) are each limited to a list of connection names (or every connection) and can be denied write access even when the server otherwise allows it - a key'sallow_writescan only narrowSQL2API_ALLOW_WRITES, never widen it. Only the admin key can manage connections, saved queries or other API keys. A key's secret is never stored, only its SHA-256 hash inapi_keys.json; the server generates it and shows it exactly once, when the key is created. Creating the first scoped key turns on authentication for the whole server immediately, even withoutSQL2API_API_KEYset (the server warns at startup if that would lock configuration changes out, since only the admin key can manage the server). - Observability: every response carries
X-Request-Id, and log lines written while handling that request carry the same ID (plain text by default;SQL2API_JSON_LOGS=1for one JSON object per line). A query taking at leastSQL2API_SLOW_QUERY_THRESHOLDseconds (default 1) is logged as a warning.GET /metrics(always public, like/health) serves Prometheus text-format metrics: request and query counts/latency histograms (by endpoint/status and by connection/dialect), idle pool occupancy, and rate-limit rejections. Logging is now configured once insidecreate_app(), so it applies under gunicorn/WSGI too, not justsql2api serve- previouslyINFO-level application logs were silently dropped in that path. GET /connections/<name>/schemalists a connection's tables and views with their columns (name, type, nullability, position) - self-service query writing without leaving the API. One catalogue query per database (information_schemafor MySQL/PostgreSQL/H2,system.tables/system.columnsfor ClickHouse,sqlite_master/pragma_table_infofor SQLite), run through the normal read-only execution pipeline, so it needs no new driver logic. Capped at 5000 columns per connection (truncated: trueif a schema is larger than that).- A small admin UI at
/ui: manage connections (including proper password-mask round-tripping) and saved queries (create, run, per-version delete, an execution-history view per version), and run ad-hoc SQL with a syntax-highlighted editor, page-size presets and Next/Previous paging - without leaving the browser. Self-contained (no build step, no external script or stylesheet) and a pure client of the existing JSON API - no new server-side logic. Linked from/docs, and shares itsX-API-Keystorage with the docs page. Query results are always rendered through DOM APIs, neverinnerHTML, so a value coming back from a database can never execute as markup - verified with a 39-assertion real-browser (Playwright) test, including an XSS-payload check, run both unauthenticated and with an API key set. - A documentation callout pointing out that
/openapi.jsoncan be imported directly by URL into Postman or Insomnia to get a ready-made request collection - no separate export step. - An "Explain" button next to Run on the Run SQL tab: runs
EXPLAIN <current query>through the existing execute path and shows the plan, a UI shortcut for a statement the SQL guard already allows. - A collapsible "Headers" panel under query results, listing every header the response actually carries
(
X-Page,X-Request-Id, etc.), built from datarenderResponse()already has. - "Copy as curl" and "Copy as TSV" buttons on the Run SQL tab's results: the former builds the exact
curlcommand for the request just made (with the API key, if any, redacted to aYOUR_KEY_HEREplaceholder so copying the command doesn't leak the key), the latter copies the current result rows as a paste-ready TSV table for Excel/Sheets - both pure client-side transforms of data already on hand. - A
sessionStorage-backed ad-hoc query history on the Run SQL tab: the last 20 distinct queries run, clickable to restore into the editor, surviving a page reload within the same tab. - A "preview" affordance next to each table in the schema browser (both the Run SQL tab's panel and the New
saved query drawer's) that fills in and runs
SELECT * FROM <table>through the existing execute path, so a table's data can be seen without hand-writing SQL. - A collapsible JSON tree for non-tabular
/execute_sqlresponses (anything that isn't a JSON array), replacing the previous flat<pre>dump - each object/array level can be expanded or collapsed.
All eight of the above were verified end-to-end with real headless-Chrome (Playwright) tests against a live server, including a dedicated clipboard-reading test for "Copy as curl"/"Copy as TSV" and coverage of both schema-browser preview entry points - zero uncaught JS errors across the runs.
Fixed¶
GET /list_filesreturned 404 ("Folder not found") on a brand-new install before anything had ever been saved, instead of an empty list - inconsistent with the very similarlatest_versions()used for the OpenAPI catalogue, which already handled this correctly. A list endpoint with nothing to list now answers{"files": []}with 200, as it always should have.- Security hardening (MySQL/ClickHouse): the single-statement/read-only SQL guard now reads string
literals with the quoting rules the target database actually uses. MySQL and ClickHouse honour a
backslash escape inside
'...'/"..."string literals by default; PostgreSQL, SQLite and H2 do not. The guard previously used one, doubling-only rule for every database. For MySQL/ClickHouse connections, a crafted value (ending in an escaped quote, more text, then a closing quote) could make the guard think a;was safely inside a string literal when the database would treat it as a live, second statement - confirmed against real MySQL and ClickHouse servers. No path to unauthorized data access or modification was found on the current codebase (this project's runners never callcursor.nextset(), so on MySQL the smuggled statement was queued but never pulled, and MySQL's own read-only-transaction mode - already set on every read-only connection - independently rejects a smuggled write; ClickHouse's server independently refuses multi-statement queries outright) - but it was a real gap in an explicitly documented guarantee and is now fixed with a dialect-aware guard, covered by a fuzz/property test suite (tests/test_sql_guard_fuzz.py, using Hypothesis) that pins the exact confirmed payload and its outcome on each database.--comments now also require a following whitespace character or end of input, matching real SQL comment syntax, and backtick-identifier doubling (``) is now recognised - both changes only make the guard more likely to reject ambiguous input, never less.
[0.3.0] - 2026-09-21¶
Added¶
- Docker images are published to GitHub Container Registry on every release (
ghcr.io/anantharajuc/sql2api, tagsX.Y.Zandlatest, plus-h2variants with Java and the H2 driver), forlinux/amd64andlinux/arm64. The workflow tests each image before publishing and can be run by hand as a dry run. docker compose up --buildstarts a self-contained demo: SQL2API in front of a seeded PostgreSQL database, with example saved queries, an API key and a rate limit. CI runs it on every change.- The image has a
HEALTHCHECKon/health, OCI labels, and access logging. - Parameter rules for saved queries: besides a type,
query_parameterscan declaredefault,required,enum,min/max,min_length/max_length,patternanddescription. Violations are rejected with a 400 that lists every problem in anerrorsmap; optional parameters without a value are bound as NULL. - Every saved query is documented as its own endpoint in
/openapi.jsonand/docs, with its parameters, rules and default connection (never its SQL). With an API key set, this section is only shown to authenticated readers, and the docs page has a box for the key. - The Release workflow now refuses to publish when the tag does not match
sql2api.__version__, is not onmain, or has no dated changelog section. - CORS support for browser clients (
SQL2API_CORS_ORIGINS, off by default): allowed origins are echoed back, preflight requests are answered without an API key, and the pagination and rate-limit headers are exposed to the page. Starting with*and no API key logs a warning. - Rate limiting (
SQL2API_RATE_LIMIT, e.g.60/minute, off by default): a per-client token bucket answering429withRetry-After, plusX-RateLimit-Limit/X-RateLimit-Remainingheaders. It runs before the API key check so key guessing is throttled;/healthand preflights are exempt. A malformed value stops startup. SQL2API_TRUST_PROXY(number of reverse proxies) makes the app use the client address and scheme fromX-Forwarded-*headers; without it those headers are ignored so they cannot be forged.
Changed¶
- Saving a query validates its
query_parametersand rejects declarations that the SQL does not use. - Requests rejected by parameter validation are not recorded in
execution_history.
Fixed¶
- The Docker image ran gunicorn with its default 30 second worker timeout, the same as the default query time limit, so a query hitting its limit raced gunicorn killing the worker. The timeout is now 120 seconds.
- The OpenAPI document was not valid OpenAPI 3.0 (
exclusiveMinimum: 0and emptyrequiredlists), which strict tools and client generators reject. It is now validated in the test suite.
[0.2.0] - 2026-09-21¶
Added¶
- Connection pooling for MySQL, PostgreSQL, ClickHouse and H2: connections are reused between requests instead of
opened per request (
SQL2API_POOL_SIZE, default 5 idle connections per distinct setting,0disables;SQL2API_POOL_IDLE_TIMEOUT, default 300 s). Against a local server, per-request time for a trivial query dropped from about 14 ms to 0.5 ms on MySQL and H2; ClickHouse barely changed (about 1.2 ms to 1.0 ms). Connections are reset between users, health-checked after idling, discarded after errors, and closed at once when a connection is changed or deleted through the API. - Query time limit: statements are cancelled on the database after
SQL2API_QUERY_TIMEOUTseconds (default 30,0disables) and the request fails with HTTP 504. A request can lower the limit with?timeout=(or atimeoutfield in the body) but never raise it. Enforced natively on MySQL/MariaDB, PostgreSQL, ClickHouse, SQLite and H2.
Changed¶
- Queries that run longer than 30 seconds are now cancelled by default. Set
SQL2API_QUERY_TIMEOUT=0to restore the previous unlimited behaviour.
Fixed¶
- The process could hang on exit after H2 had served concurrent requests: JPype waited forever for worker threads that jaydebeapi had attached to the JVM as non-daemon threads. Threads that use H2 are now attached as daemons.
[0.1.0] - 2026-09-21¶
First public release, restructured from the original single-file application.
Added¶
- Installable
sql2apipackage with asql2api serve/sql2api initcommand line andpython -m sql2api. - Bound query parameters (
:name) for every database, so values never become part of the SQL text. - Saved queries served as endpoints:
GET|POST /q/<name>with typed parameters and an optional default connection. DELETE /saved_sql/<name>(whole query or one?version=) andDELETE /connections/<name>.- Execution history recorded per saved-query version (last 50 runs, with status, row count and duration).
X-Page,X-Page-SizeandX-Has-Moreresponse headers;ndjsonoutput format.${ENV_VAR}references in connection settings so secrets can stay out ofdb_connections.json.- OpenAPI description at
/openapi.json, Swagger UI at/docs(/redirects there), and a/healthendpoint. - Read-only-by-default execution (
SQL2API_ALLOW_WRITES), optional API key (SQL2API_API_KEY), page size limit (SQL2API_MAX_PAGE_SIZE) and configurable data folder (SQL2API_HOME). - Dockerfile, GitHub Actions CI (unit tests plus integration tests against PostgreSQL, MySQL, ClickHouse and H2), Dependabot, and runnable examples.
Changed¶
- Saved-query and connection files are read from
SQL2API_HOME(default: the current directory) instead of the folder next to the source file; file access is confined tosaved_sql/. - Passwords are masked by
GET /connections. - Unknown
formatvalues now return 400;page_sizeis capped; errors use proper HTTP status codes. - The development server no longer runs in debug mode by default.
Fixed¶
- Arbitrary file read through
/view_file_contentand path traversal through saved-query filenames. - Pagination now works on every database; trailing
LIMIT/OFFSEThandling is case-insensitive. - Database connections are always closed; ClickHouse queries no longer run twice.
- JSON column order is preserved; Decimal, date and driver-specific number types serialise correctly.
- Concurrent saves can no longer lose a version.