0.4.0
版本发布时间: 2023-01-16 12:50:28
PRQL/prql最新发布版本:0.13.0(2024-07-26 01:27:49)
0.4.0 brings lots of new features including switch
, select ![]
and numbers with underscores. We have initial (unpublished) bindings to Elixir. And there's the usual improvements to fixes & documentation (only a minority are listed below in this release).
0.4.0 also has some breaking changes: table
is let
, dialect
is renamed to target
, and the compiler's API has changed. Full details below.
Features:
-
Defining a temporary table is now expressed as
let
rather thantable
(@aljazerzen, #1315). See the tables docs for details. -
Experimental: The
switch
function sets a variable to a value based on one of several expressions (@aljazerzen, #1278).derive var = switch [ score <= 10 -> "low", score <= 30 -> "medium", score <= 70 -> "high", true -> "very high", ]
...compiles to:
SELECT *, CASE WHEN score <= 10 THEN 'low' WHEN score <= 30 THEN 'medium' WHEN score <= 70 THEN 'high' ELSE 'very high' END AS var FROM bar
Check out the
switch
docs for more details. -
Experimental: Columns can be excluded by name with
select
(@aljazerzen, #1329)from albums select ![title, composer]
-
Experimental:
append
transform, equivalent toUNION ALL
in SQL. (@aljazerzen, #894)from employees append managers
Check out the
append
docs for more details. -
Numbers can contain underscores, which can make reading long numbers easier (@max-sixty, #1467):
from numbers select [ small = 1.000_000_1, big = 5_000_000, ]
-
The SQL output contains a comment with the PRQL compiler version (@aljazerzen, #1322)
-
dialect
is renamed totarget
, and its values are prefixed withsql.
(@max-sixty, #1388); for example:prql target:sql.bigquery # previously was `dialect:bigquery` from employees
This gives us the flexibility to target other languages than SQL in the long term.
-
Tables definitions can contain a bare s-string (@max-sixty, #1422), which enables us to include a full CTE of SQL, for example:
let grouping = s""" SELECT SUM(a) FROM tbl GROUP BY GROUPING SETS ((b, c, d), (d), (b, d)) """
-
Ranges supplied to
in
can be half-open (@aljazerzen, #1330). -
The crate's external API has changed to allow for compiling to intermediate representation. This also affects bindings. See
prql_compiler
docs for more details.
Fixes:
[This release, the changelog only contains a subset of fixes]
- Allow interpolations in table s-strings (@aljazerzen, #1337)
Documentation:
[This release, the changelog only contains a subset of documentation improvements]
- Add docs on aliases in Select
- Add JS template literal and multiline example (@BCsabaEngine, #1432)
- JS template literal and multiline example (@BCsabaEngine, #1432)
- Improve prql-compiler docs & examples (@aljazerzen, #1515)
- Fix string highlighting in book (@max-sixty, #1264)
Web:
- The playground allows querying some sample data. As before, the result updates on every keystroke. (@aljazerzen, #1305)
Integrations:
[This release, the changelog only contains a subset of integration improvements]
- Added Elixir integration exposing PRQL functions as NIFs (#1500, @kasvith)
- Exposed Elixir flavor with exceptions (#1513, @kasvith)
- Rename
prql-compiler
binary toprqlc
(@aljazerzen #1515)
Internal changes:
[This release, the changelog only contains a subset of internal changes]
- Add parsing for negative select (@max-sixty, #1317)
- Allow for additional builtin functions (@aljazerzen, #1325)
- Add an automated check for typos (@max-sixty, #1421)
- Add tasks for running playground & book (@max-sixty, #1265)
- Add tasks for running tests on every file change (@max-sixty, #1380)
New contributors:
- @EArazli, with #1359
- @boramalper, with #1362
- @allurefx, with #1377
- @bcho, with #1375
- @JettChenT, with #1385
- @BlurrechDev, with #1411
- @BCsabaEngine, with #1432
- @kasvith, with #1500