Measures in XTDB #4700
refset
started this conversation in
Show and tell
Replies: 1 comment
-
|
Yes - and also in XT's 'pipeline SQL': FROM orders
SELECT region, sales, sales - cost AS profit
SELECT *, profit / sales as margin
SELECT region,
SUM(profit) AS total_profit,
AVG(margin) AS avg_margin |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I was reminded yesterday (after seeing this DuckDB post) of this work/paper: "Measures in SQL" https://arxiv.org/pdf/2406.00251v1 - a way of extending SQL to improve its ability to serve as a 'semantic layer' without requiring the use of a templating engine on top of SQL (e.g. dbt)
I just had a quick play around and managed to demonstrate that XTQL's
withoperator effectively solves this already:vs.
vs.
[Play]
i.e. a whole library of measure definitions can be trivially added to a query (assuming they're topologically sorted) as a series of
withoperators, whilst keeping things easy to readDoes that seem useful?
Beta Was this translation helpful? Give feedback.
All reactions