GithubHelp home page GithubHelp logo

recursive sql / prql about prql HOT 4 CLOSED

prql avatar prql commented on May 19, 2024
recursive sql / prql

from prql.

Comments (4)

max-sixty avatar max-sixty commented on May 19, 2024 1

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.

max-sixty avatar max-sixty commented on May 19, 2024

Thanks for the issue @ledinscak

What would the materialized SQL you'd want to output for that, approximately?

from prql.

ledinscak avatar ledinscak commented on May 19, 2024

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.

ledinscak avatar ledinscak commented on May 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.