The Problem with SQL
SQL is vertical, verbose, and clunky inside modern codebases. It interrupts your flow. When you are writing concise Rust or JavaScript, suddenly dropping into a 10-line SQL block feels like hitting a wall.
The QAIL Solution
QAIL is horizontal, dense, and composable. It treats database queries like a pipeline, using symbols to hook data and pull it into your application.
SELECT id, email, role FROM users WHERE active = true LIMIT 1;
get::users•@id@email@role[active=true][lim=1]
The 3 Core Principles
- Constraint: Vertical space is precious. QAIL flows with your logic, not against it.
- Density: Symbols (`@`, `•`, `[]`) convey more information per pixel than keywords.
- The Star Rule: If you need 50 columns, fetch the struct (`@*`). If you need 3, list them. Listing 20 columns manually is an anti-pattern.
The Vertical Escape Hatch
Horizontal is the Identity. Vertical is the Layout.
We provide a "Vertical Escape Hatch" (tabs/newlines) so you can organize complex logic however you see fit, without fighting the parser. But the language itself remains symbol-driven and concise.
qail!(r#"
get::users->bookings•@*
[created_at>='2024-01-01']
[email_verified=true]
[bookings.campaign_code~$1]
[^!created_at]
[lim=50]
"#)
This allows you to handle complexity without abandoning the core philosophy.