Skip to content

Commit

Permalink
docs: language design notes (#1830)
Browse files Browse the repository at this point in the history
  • Loading branch information
aljazerzen authored Feb 14, 2023
1 parent 7bf1a93 commit 0406d1a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions book/src/internals/language-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Language design

In a way PRQL is just a transpiler to SQL. This can cause its language design to
gravitate toward thinking about PRQL features in terms of how they translate to
SQL.

```
PRQL feature -> SQL feature -> relational result
```

This is flawed because:

- it does not model interactions between features well,
- SQL behavior can sometimes be misleading (the order of a subquery will not
persist in the parent query) or even differs between dialects (set
operations).

Instead, we should think of PRQL features in terms of how they affect PRQL
expressions, which in most cases means how they affect relations.

```
PRQL feature -> relation
|
v
PRQL feature -> relation
|
v
PRQL feature -> relation
|
v
relational result
```

Thinking about SQL comes in only at the last step when relation (or rather
relational expression) is translated to an SQL expression.

0 comments on commit 0406d1a

Please sign in to comment.