Skip to content
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

Allow no main pipeline? #1803

Closed
max-sixty opened this issue Feb 12, 2023 · 9 comments
Closed

Allow no main pipeline? #1803

max-sixty opened this issue Feb 12, 2023 · 9 comments
Labels
language-design Changes to PRQL-the-language

Comments

@max-sixty
Copy link
Member

Opening the std.prql file in VSCode returns an error missing main pipeline. It's possible to replicate with:

func add -> a + b

Should we allow files with no queries? This will become more important when we want to allow importing items from other files.

@max-sixty max-sixty added the language-design Changes to PRQL-the-language label Feb 12, 2023
@vanillajonathan
Copy link
Collaborator

This would be useful for:

and if the language were to be extended to also be a Data Manipulation Language (DML), Data Definition Language (DDL), and/or Data Control Language (DCL).

@richb-hanover
Copy link
Contributor

Should we allow files with no queries? This will become more important when we want to allow importing items from other files.

I think it's desirable to permit this. Another manifestation is with the first bullet in #1728. It's thinkable that a "no-query" input should generate an empty output from the PRQL compiler that indicates "no pipeline"

@max-sixty
Copy link
Member Author

As discussed in #1825 — I think we should be able to parse these queries, but not compile them.

parse allows this:

$ echo "let x = 2" | prqlc parse
- VarDef:
    name: x
    value:
      Literal: !Integer 2

...but somewhere the VSCode extension is raising an error. So possibly this is an issue with that? It shouldn't be trying to compile every PRQL file... I'll open an issue there

@RandomFractals
Copy link

RandomFractals commented Feb 27, 2023

PRQL vscode extension only uses compile and shows any errors that produces. Nothing has changed there since v0.4.2 when I took over.

Also, should not compile parse PRQL first and generate errors for invalid PRQL before even trying to compile it, and not create error messages when PRQ is valid, or prqlCode is an empty string?

More at: PRQL/prql-vscode#128 (comment)

@RandomFractals
Copy link

RandomFractals commented Feb 27, 2023

As discussed in #1825 — I think we should be able to parse these queries, but not compile them.

parse allows this:

$ echo "let x = 2" | prqlc parse
- VarDef:
    name: x
    value:
      Literal: !Integer 2

...but somewhere the VSCode extension is raising an error. So possibly this is an issue with that? It shouldn't be trying to compile every PRQL file... I'll open an issue there

That looks like some kind of AST of PRQL code.

Do you think PRQL extension should display it in Outline instead as other code editors do?

PRQL document outline is empty in vscode ext. v0.6.0. That is where PRQL parse/statements tree display should be added, which would be a new feature request, in addition to prql compiler not produce errors when there are not any.

image

@max-sixty
Copy link
Member Author

Lots of stuff here & the related issues which I'll aim to go through later. Just to confirm one thing:

Nothing has changed there since v0.4.2 when I took over.

Totally, this is definitely something that's been there for ages, not on you at all! (and even if it were, these issues are to be expected)

@RandomFractals
Copy link

RandomFractals commented Feb 28, 2023

yeah, it is an issue we need to resolve, even for empty prql documents. I noticed that error too when I was prepping ext. v0.6 release.

I propose we consider adding info and warning messages to the compiler, not just errors. Then display them in the Problems panel in vscode, and we can display them in Preview if there is no other output generated.

That would make it consistent for all the compiler api clients too, and use the standard nomenclature of error, warn, info messages display most compilers and linters use.

We should consider showing parsed PRQL AST in vscode Outline, but that's a much larger effort we can discuss separately.

@vanillajonathan
Copy link
Collaborator

I propose we consider adding info and warning messages to the compiler, not just errors.

I very much like this idea!

@max-sixty
Copy link
Member Author

The immediate question is subsumed by #2129, and I think we have a very viable path forward.

PRQL/prql-vscode#128 remains, but we can continue on that issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language-design Changes to PRQL-the-language
Projects
None yet
Development

No branches or pull requests

4 participants