prql icon indicating copy to clipboard operation
prql copied to clipboard

Use s-strings to generate a CTE

Open max-sixty opened this issue 3 years ago • 4 comments

Currently:

table x = (
  s"SELECT * FROM employees"
)

from x

returns

Expected a known transformation; got s

I'm not sure the exact form that the s-string should be in, but this would allow any form of escape hatch. Currently if someone wanted to do something beyond a statement — e.g. a lateral join, which we don't support — then that wouldn't be possibl.

max-sixty avatar Apr 17 '22 21:04 max-sixty

I would expect such statement to have form of:

table x = s"SELECT * FROM employees"

because a SELECT has the same "type" as a pipeline not a transform inside a pipeline.

aljazerzen avatar Apr 18 '22 06:04 aljazerzen

Yes agree, good point. (It does give the same error though)

max-sixty avatar Apr 18 '22 06:04 max-sixty

I notice you took off the milestone — how difficult do you think this is @aljazerzen ? I do think that we're likely to have lots of missing things, and so without this, people will hit a cap without an escape hatch.

I may try and implement r# strings, which would be necessary for this.

max-sixty avatar Apr 18 '22 17:04 max-sixty

It would require a few tweaks to the parser, which might cause a cascade.

I didn't know how important is it, I you feel that people will quickly hit this limit, we can do it in 0.2 milestone.

aljazerzen avatar Apr 18 '22 19:04 aljazerzen

Closed by #1197

aljazerzen avatar Dec 01 '22 11:12 aljazerzen