Skip to content

Concepts

This section explains the core ideas and design values behind ASQL.

Core Concepts

Design Values

ASQL is built on deliberate tradeoffs—we value:

1. Pipeline Order Over Projection-First

SQL's syntax was designed in the 1970s. The written order doesn't match execution:

SELECT region, SUM(amount)     -- 5th
FROM sales                      -- 1st
WHERE year = 2024               -- 2nd
GROUP BY region                 -- 3rd
HAVING SUM(amount) > 1000       -- 4th
ORDER BY 2 DESC                 -- 6th

ASQL writes queries in the order they execute. Data flows top-to-bottom. This not only reads more naturally, but eliminates the messy subquery and CTE scaffolding that traditional SQL requires due to its choice to be projection-first.

2. Convention Over Configuration

The best configuration is no configuration. When columns like user_id and created_at follow predictable patterns, ASQL can infer relationships and types automatically:

  • user_id enables .user. dot traversal
  • created_at is recognized as a timestamp
  • Table names are pluralized automatically

You write less, and the query stays focused on what you want, not how to get it.

3. Familiarity Over Novelty

New syntax has a cost: every teammate must learn it, every code review must translate it. ASQL keeps SQL's vocabulary so your existing knowledge transfers:

  • select, where, order by, limit
  • sum(), avg(), count()
  • join, on, as

The learning curve is hours, not weeks.

4. Portable Over Proprietary

Proprietary query languages lock you to a vendor. When you need to switch databases or debug performance, you're stuck. ASQL transpiles to all major SQL dialects—Postgres, BigQuery, Snowflake, DuckDB, and more. You can always inspect the generated SQL and take your queries anywhere.

5. Completeness Over Fast Queries

Analytics and data modeling require complete data. When groups and ranges are guaranteed—unlike traditional SQL—complexity and uncertainty are greatly reduced. The tradeoff? Typically less than 5% extra query time. Date spines are generated in-memory (milliseconds). Categorical spines add one lightweight DISTINCT query. For analytics, correctness over raw speed is an obvious choice.

6. Concise Over Verbose

Redundant explicitness isn't clarity—it's noise. When user_id obviously points to users.id, forcing you to write it out adds nothing but error surface. ASQL optimizes for the reader: the query shows what's unique about this analysis, not boilerplate that's true of every query.

Examples of noise ASQL eliminates:

SQL Boilerplate ASQL
ON orders.user_id = users.id & users or & users on user_id
SELECT region, SUM(amount) ... GROUP BY region group by region (sum(amount))
SUM(amount) AS sum_amount sum_amount (auto-alias from expression)
users.name, users.email, users.id name, email, id (auto-qualification)
Subqueries to reference computed columns Pipeline handles it

Every character should carry meaning. If the computer can infer it, you shouldn't have to type it.

7. Code Comments Over Catalogues

Software engineering learned this decades ago: external documentation rots. The wiki says one thing, the code does another, and nobody knows which is right. Data teams are still catching up. When comments live in the query, they travel with it—versioned, reviewed, and maintained together.

ASQL preserves your -- comments through transpilation. It also adds helpful comments to explain generated SQL (like spine CTEs), so the output is self-documenting.

Next Steps