-
Notifications
You must be signed in to change notification settings - Fork 7
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
Create View from prql #5
Comments
Hi Jannis, this sounds more like a feature request for prql itself (see also PRQL/prql#16). My project currently just wraps the prql compiler and only supports the language features of that compiler. An alternative might be to look at my other project PSQL, which is a piped language that has full DuckDB support. In the README there is an example for creating a view. |
I'd also like this feature, it would be nice to have some kind of delimiter the plugin recognizes to dispatch the PRQL code to the compiler, and replace the result into the rest of the quey e.g: SET prql_literal=🇵;
create temp table foo as (
🇵
from stuff
filter weight < 3
select { name, colour }
derive fun_factor 6 * cost
🇵
); I know that's a lot easier said than done, and if I had a moment to spare I'd even try and do it myself 😄 |
From the PRQL side, we'd like to make it easy for tools to support this sort of thing. We've tried to avoid implementing it in the PRQL language, so we can keep the PRQL language focused on the querying, and then other tools can wrap the queries in whatever they wish. If there's anything we can do on our end, let us know. For example, I think we could guarantee that something like |
I've pushed a change that provides this now with a special syntax
Future work could include making the syntax customizable. |
This is fantastic, though I can now understand any hesitance to take it on 😅 ... My first use case was similar to this WITH invoices_remote_data AS (FROM read_csv_auto('https://raw.githubusercontent.com/PRQL/prql/0.8.0/prql-compiler/tests/integration/data/chinook/invoices.csv'))
(|
let foo = [{x=3,y=4}, {x=1,y=7}]
from invoices_remote_data
join foo (3==foo.x)
filter invoice_date >= @1970-01-16
derive { transaction_fees = 0.8, income = total - transaction_fees }
|); Which causes the PRQL to compile it's own |
Ah, I see. You can work around the
|
Ahh of course! thank again. |
Hi,
great work!
Is it somehow possible to create a View from an prql-Query?
Thanks,
Jannis
The text was updated successfully, but these errors were encountered: