-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idea for more PRQLish table creation grammar #2427
Comments
Woah, I really like this. Having But as always, we need to find a suiting syntax. There are a few considerations:
|
The syntax you propose is pretty close to perfect given my considerations, I'd only replace
|
Do we want to allow things like this:
If not, maybe remove the assigning part and stick a keyword in front of the table name?
|
|
Haven't thought too much about that one ... I think the main feature would be to enable "ending" a pipe chunk with a let to be able to start another one after. And basically you get to this stuff if you are doing anything complicated with table creation and joins where currently you really start to feel like it's not clean PRQL anymore. |
In that example I'm not clear on why one would want the pipe filter like that ... I think it can be done with a vanilla select line above? |
I'm keen on this / some variant of it! Re the "what term do we choose for |
Are there other languages that allow this postfix lvalue? The one I can think of is a python repl, which allows something similar — @cottrell 's original example of |
I'm not saying that someone would want that - just that someone might try it someday. In
That's why it may be wise to make it clear that this syntax is special and that part after
Ugh, I don't think this should be the same keyword. See this example:
Here, All in all, I prefer |
One more thing: we do agree that this should be allowed only in the top-level pipeline, right? This should all be forbidden, right?
|
Hmmm — but IIUC we're not writing I was thinking that |
One awkward-but-minor thing about In order to parse
|
Well that's the point, is it not? In your example, I think it should be possible to produce an error "expected a name or I see your point of "let can sometimes be seen as the last function of preceding pipeline or a new declaration", but this will the a problem unless we completely change the keyword to something like:
I dislike that a bit, because it makes it harder to spot where TableA is declared. |
🤣 What I was trying to say is form & function (or "aesthetics & semantics") should be correlated; these have very different semantics insofar as they delineate expressions, and so arguably should have more different aesthetics. We don't have other cases where we have two-word-keyword (It's not like When I'm reading the text, my mind doesn't know "is this the culmination of this expression or am I starting a new one?" That said, this point is very based in my experience, if others don't feel this then we shouldn't load on my experience alone.
Yes I was thinking something like this. Or even Overall I'm open to either, with a slight weight on something other than |
I probably don't follow all the subtleties here but might it be easier to start, at least conceptually and as a way to try things out in some experimental mode, with something totally unique and new like
and then separately create aliases to these things that are convenient/nice/stylish? Convenience and style is quite difficult IMO. |
You are right. We don't (yet) have things like I'm convinced, with @cottrell I don't know what you mean, can you elaborate? |
I just meant, if it is hard to decide on the how to incorporate the operations into the existing framework, it might be easier to simply create two new operations "store_into" and "end_pipe" for now just to see if there are any blockers. I also like |
Great discussion and the final syntax you arrived at is the best of all the options you considered. |
What's up?
Currently, I think the only way to create tables is
But it might be useful for a number of reasons to allow some pipeline operator for creating tables like this:
The point would be to allow components (table definition) to avoid nesting structures that basically block the ability to simply use concat/append as the base operator for constructing pipelines.
So someone might define some vanilla PRQL pipeline and you could then take that and simply extend it more more pipeline logic OR turn it into a table simply by + "let TableA" which sounds like not a big deal but removes a lot of complexity that leaks out of the components when you need to keep track of the type of the query object in order to combine with other query objects.
UPDATE:
And to be clear, the intention is to enable the following
The text was updated successfully, but these errors were encountered: