Concepts¶
This section explains the core ideas and design values behind ASQL.
Core Concepts¶
- Pipeline Semantics — Why FROM-first and what it means for your queries
- Guaranteed Groups — Automatic gap-filling for complete analytics
- Convention Over Configuration — How ASQL infers relationships and defaults
- Function Shorthand — Underscore/space flexibility explained
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.
Related Features¶
- Pipeline Semantics — deep dive on execution order
- Pipeline Syntax — FROM-first query structure
- Aggregations — no HAVING keyword needed
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_idenables.user.dot traversalcreated_atis 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.
Related Features¶
- Conventions — naming patterns ASQL recognizes
- Auto-aliasing — automatic column naming
- Joins — implicit join syntax
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,limitsum(),avg(),count()join,on,as
The learning curve is hours, not weeks.
Related Features¶
- Functions — SQL-compatible function reference
- Operators — standard operators
- Keywords — familiar SQL keywords
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.
Related Features¶
- Dialect Limitations — what works where
- Integrating ASQL — using ASQL with your stack
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.
Related Features¶
- Guaranteed Groups — how gap-filling works
- Spines and Performance — detailed performance analysis
- Aggregations — OVER EVERY syntax
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.
Related Features¶
- Auto-aliasing — automatic column naming
- Joins — implicit and shorthand join syntax
- Aggregations — inline grouping syntax
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.
Related Features¶
- Comments Syntax — inline comments in queries
- Transpilation Comments — ASQL-generated explanations
Next Steps¶
- Pipeline Semantics — Deep dive into FROM-first design
- Guaranteed Groups — Understanding automatic gap-filling
- Syntax Guide — Complete syntax reference