-
Notifications
You must be signed in to change notification settings - Fork 9
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
Handling of PRQL source files without main pipeline #128
Comments
PRQL vscode extension only uses prql compile, always has been. From https://github.com/PRQL/prql-vscode/blob/main/src/compiler.ts#L27 try {
// run prql compile
return prql.compile(prqlString, compileOptions) as string;
}
catch (error) {
if ((error as any)?.message) {
try {
const errorMessages = JSON.parse((error as any).message);
return errorMessages.inner as ErrorMessage[];
}
catch (ignored) {
throw error;
}
}
throw error;
} See my comment in the original ticket (PRQL/prql#1803 (comment)) about parse before compile, and any errors that might generate. We can change this behaviour, but then let's specify what we should call and in what order, and do we still display both parse and compiler errors the way we do now? Maybe let's change this ticket title to Display Parse Errors? or provide Parse and Compile PRQL options in extension? It's not clear what the ask is here, but sounds like a UX enhancement. Per current compiler API design, I think that Please tag me in the discussions of modular PRQL parse/compile design in the core repo. I don't think the proposed custom error code for extension to check is a good solution not just for extension, but for the other PRQL compiler api clients too (Py, CLIs and other plugins). |
also, please review the suggested UI design to support multiple pipeline definitions in a single https://discord.com/channels/936728116712316989/1028380004226171032/1078302829380386899 |
@max-sixty @aljazerzen @RandomFractals As we discuss the "no pipeline" state, it might be useful to have an output state from the compiler that let me type the following without error:
If the PRQL that was entered is syntactically correct, perhaps the "no pipeline" could instead be a "No SQL emitted" or "No SQL Query" state. That also could be used in the right pane of the Playground to indicate that there's no error, but that there isn't any SQL (yet). Thanks. |
I think that the contract of the I see two ways around this:
and @richb-hanover yes - the error message from the prql-compiler should be improved. |
@aljazerzen - Either of these plans addresses my concern. Thanks. |
Why should PRQL compiler behave or be any different? Perhaps prql Still sounds odd that a compiler would generate no result, or that error even for an empty prql document as it does now :) Also, changing the compiler behavior to parse before compile should simplify its public api too.
|
How is this used in PRQL documents now? Can you provide a full example that actually has some output after those definitions, or uses that var and function? It does sound like the change should be made in the compiler itself to not produce that error, or generate an Info type message instead. It would be cleaner to display parse/compile state info messages, rather than some cryptic error codes that will require more documentation. Besides, we are using standard vscode diagnostics and display those messages in the Problems panel already. Info messages can be displayed there too, and changing the compiler and extension to display parse/compile outcome state this way would be more like how all other built-in and 3rd extensions do it in vscode. With that, I believe the fix for the reported pipeline error should be made in the compiler first. |
missing main pipeline
error
I see that we should first define what is a PRQL source file and how it can export stuff. Before we do that, I see that it is confusing to talk about |
so, I just tried it with v0.6.1 ext. and prql compiler update from #150 . That error message looks more informative now. @max-sixty Not sure if you want to keep this open, or close it and require a query in valid prql files. |
@max-sixty @aljazerzen @RandomFractals This is a thing of beauty. Thanks, all. My one comment is that the message could be "No query" or "No SQL Query". The "Missing query" message could lead the reader to think that there's something wrong. Thanks again. |
I was thinking that we wouldn't generate an error in VS Code here. Because it's actually fine to have a
I can make the change if we all agree! Though maybe this is moot if we're planning to hide the error. |
You decide. I don't feel strongly how this sugars out in the end. Thanks |
As discussed in PRQL/prql#1803 (and screenshot at PRQL/prql#1825 (comment)), currently the extension will raise an error on files that don't have main pipelines.
Because we're planning to start allowing "module" files, this will become more prevalent. (At the moment it really only affects the developers who have
std.prql
open...)As discussed on the linked issue, these should be possible to parse, even if not compile. So it would be great to understand why we get this error, given I'd think we don't need to compile PRQL files before we want to preview them.
The text was updated successfully, but these errors were encountered: