Comments (4)
My guess would be that we don't need recursion in the transpiler from PRQL to SQL initially. Though we should be open to it if people find good cases.
I'm actually not familiar with recursion in SQL, maybe I haven't used the cool DBs that much. If there is SQL that does recursion then we should be able to produce it.
The thing that would be helpful is the actual SQL that you'd like to produce (PRQL just produces SQL, it doesn't do anything with the data itself). If it's an important case, please feel free to put a PR in with an example of the SQL and an estimate of the PRQL that should produce it.
Thanks @ledinscak
from prql.
Thanks for the issue @ledinscak
What would the materialized SQL you'd want to output for that, approximately?
from prql.
this is simplest form of recursion it is one column with integers from 1 to 11
n |
---|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
I took example from: https://medium.com/swlh/recursion-in-sql-explained-graphically-679f6a0f143b
from prql.
There is ANSI SQL standard for recursions, so I thought approach with functions could do very well here, this is of course simple arithmetic example, see on linked page examples with parent - child relations. Point is that select part is repeated two or even three times with different where filters. In simple example last select could have also been written as:
select * from numbers -> select n from numbers, so we have
select 1
...
select n + 1 from ...
...
select n from ...
I didn't think over solution at all, just thought it is something worth to consider, because recursions are always hard to understand :-)
from prql.
Related Issues (20)
- Nightly tests failed
- Parentheses omitted from sql output in non-commutative operations HOT 8
- Nightly tests failed HOT 1
- Name of the type for UTF-8 encoded strings of textual data HOT 4
- Top with group on Postgres HOT 5
- `std.prql` module HOT 2
- Modules containing data (tables, relations) HOT 3
- Release plan for 0.11.1 HOT 2
- Nightly tests failed HOT 1
- Remove `std.prql_version` in favor of `std.prql.version` HOT 5
- Nightly tests failed HOT 4
- Grouping breaks `select * except` HOT 2
- Set up text "fixture" for CLI project tests
- Clickhouse DATETIME conversion invalid format HOT 4
- Zig tests started failing HOT 3
- The various exit status codes from `prqlc` HOT 2
- Python compiler needs a flag to return the full sequence of errors as json HOT 5
- Compiler panic with `sort` in inline join relation HOT 5
- Nightly tests failed HOT 1
- `**` operator (or something else) for `math.pow` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prql.