Skip to content

Query Language (AQL)

AQL is a query language that compiles to parameterized PostgreSQL SQL. You write queries in .aql files; Axel outputs SQL strings you execute with your language’s standard driver. Axel never runs queries for you.

query.aql

The reference is split by feature:

  • Parameters — named, optional, and typed query parameters.
  • Select — single vs multi, shapes, filters, ordering, nested links, and aggregates.
  • Insert — inserting rows, links, and unless conflict upserts.
  • Update — updates and partial updates.
  • Delete — deleting rows.
  • Expressions — operators, literals, path expressions, and casts.
  • With — bind a subquery once with with (...) and reuse it across the query.
  • Directives@name / @request / @response codegen metadata.
  • Grammar reference — the full AQL grammar.

Every compiled query produces:

  • A positional-parameter SQL string ($1, $2, …)
  • A comment header mapping parameter names to positions
-- $1: email (str)
-- $2: active (bool)
SELECT u.id AS id, u.email AS email
FROM "user" u
WHERE u.email = $1 AND u.active = $2;

The parameter order matches first-appearance order in the query.