Skip to main content

Creating a Query

A saved query pairs a piece of SQL with a database connection and a name. Once saved, it can be run, shared, scheduled, and put on dashboards.

Steps​

Only the group's owner and its editors can create queries.

  1. From the Queries view, choose Create query. When the group's plan has no room for another query, it opens the Packages screen instead.
  2. Select a connection in Database connection — the database the query runs against — or choose Add new connection, fill in its details and click Check connection (see Database connections).
  3. Enter a Description (the name of the query) and, optionally, Tags, and the Visibility and Log settings.
  4. Click Create and Edit: the query is saved and opens in the editor. Without a Description or a connection the query is not saved and the page shows "Not all data seems to be filled correctly!".
  5. Write your SQL. The editor provides schema-aware autocomplete for your tables and columns. See Writing SQL.
  6. Save it, or Save and Run to see what it returns.
Free plan limit

A group on the Free plan can hold up to 3 saved queries. Paid plans raise this limit (Individual 25, Team 100, Enterprise 250 queries, Unlimited without a limit) — see Plans and limits. The 2 sample queries that a new account gets on app.kvery.io count toward the limit; delete them when you need the room.

GET-style vs. POST-style queries​

Kvery classifies a query by the words of its SQL, which affects how it is run and how it takes its values:

  • Write queries (POST-style) contain INSERT, UPDATE, DELETE, REPLACE, ALTER or CREATE followed by a space anywhere in the text, in any letter case. Their run form posts the values. Published as an API, they take no query-string values from a GET request: callers send the values with POST, PUT, PATCH or DELETE (see HTTP methods and write queries).
  • Read queries (GET-style) are all other queries (SELECT, EXEC, WITH …). They return rows and take their values with any method.

This classification is automatic — you do not configure it manually. See Writing SQL.

Adding parameters​

To make a query reusable, turn values into input fields with form variables:

SELECT *
FROM orders
WHERE status = '$status'
AND created_at >= '$from_date';

Kvery detects $status and $from_date and renders form fields for them. See Form variables for field types, defaults, and validation.

After saving​

In the editor, the buttons below the SQL — Visibility, Custom CSS, Form settings, Add button, Import, Table settings, Thresholds, Log and Cache — open the rest of the query's settings; see Query settings.

Once saved, your query appears in the Queries list. From there you can open its run page and choose a result layout there, enable sharing, set up a schedule, or add it to a dashboard.

Changes to a shared query are staged as a draft

When you edit a query that is already shared, saved changes to its SQL and form are kept as a draft. Everywhere outside the app — shared links and dashboards, the public query API, the MCP server, Swagger and scheduled runs — the published version is used until you publish the draft.