- Notifications
You must be signed in to change notification settings - Fork247
PRQL is a modern language for transforming data — a simple, powerful, pipelined SQL replacement
License
PRQL/prql
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
PipelinedRelationalQueryLanguage, pronounced "Prequel".
PRQL is a modern language for transforming data — a simple, powerful, pipelinedSQL replacement. Like SQL, it's readable, explicit and declarative. Unlike SQL,it forms a logical pipeline of transformations, and supports abstractions suchas variables and functions. It can be used with any database that uses SQL,since it compiles to SQL.
PRQL can be as simple as:
fromtracksfilterartist=="Bob Marley" #Each line transforms the previous resultaggregate{ #`aggregate` reduces each column to a value plays= sum plays, longest= max length, shortest= min length, #Trailing commas are allowed}
Here's a larger example of the language:
fromemployeesfilterstart_date> @2021-01-01 #Clear date syntaxderive{ #`derive` adds columns/ variables gross_salary= salary+(tax??0), #Terse coalesce gross_cost= gross_salary+ benefits_cost, #Variables can use other variables}filtergross_cost>0group{title, country}( #`group` runs a pipeline over each group aggregate{ #`aggregate` reduces each group to a value average gross_salary, sum_gross_cost= sum gross_cost, # `=` sets a column name})filtersum_gross_cost> 100_000 #`filter` replaces bothofSQL's`WHERE`&`HAVING`deriveid= f"{title}_{country}" #F-strings likePythonderivecountry_code= s"LEFT(country, 2)" #S-strings allow usingSQLasan escape hatchsort{sum_gross_cost,-country} # `-country` means descending ordertake1..20 #Range expressions(also valid hereas`take20`)
For more on the language, more examples & comparisons with SQL, visitprql-lang.org. To experiment with PRQL in the browser, check outPRQL Playground.
PRQL is ready to use by the intrepid, either with our supported integrations, orwithin your own tools, using one of our supported language bindings.
PRQL still has some bugs and some missing features, and is probably only readyto be rolled out to non-technical teams for fairly simple queries.
Development has slowed in the past few months as we decide how to work on a newresolver, which will let us squash many bugs and simplify our code a lot. It'llalso let us scale the language without scaling the complexity of the compiler.
While we figure that out, we're also thinking about:
- Ensuring our supported features feel extremely robust; resolving anypriority bugs.As more folks have started using PRQL, we've had more bug reports — good news,but also gives us more to work on.
- Filling remaining feature gaps, so that PRQL is possible to use for almost allstandard SQL queries.
- Expanding our set of supported features — we are working to add experimentalsupport for modules / multi-file projects, and for auto-formatting.
And:
- Making it really easy to start using PRQL. We're doing that by buildingintegrations with tools that folks already use; for example a VS Codeextension, Jupyter integration, and the recentQStudio integration. If thereare tools you're familiar with that you think would be open to integratingwith PRQL, please let us know in an issue.
- Whether all our initial decisions were correct — for examplehow we handle window functions outside of a
windowtransform. - Making it easier to contribute to the compiler. We have a wide group ofcontributors to the project, but contributions to the compiler itself arequite concentrated. We're keen to expand this;#1840 for feedback, somesuggestions on starter issues are below.
We're increasingly open to contributions for bigger rewrites of the resolvergiven how bottlenecked we are on it. If you're interested in contributing,please reach out in an issue or on Discord.
To stay in touch with PRQL:
- Follow us onTwitter
- Join us onDiscord
- Star this repo
- Contribute — join us in building PRQL, through writing code(send us your use-cases!), orinspiring others to use it.
- See thedevelopment documentation for PRQL. It's easy to getstarted — the project can be built in a couple of commands, and we're a reallyfriendly community!
- For those who might be interested in contributing to the code now, check outissues with thegood first issuelabel. Always feel free to ask questions or open a draft PR.
- PRQL Playground — experiment with PRQL in the browser.
- PRQL Book — the language documentation.
- Jupyter magic —run PRQL in Jupyter, either against a DB, or a Pandas DataFrame / CSV /Parquet file through DuckDB.
- pyprql Docs — the pyprql documentation, thePython bindings to PRQL, including Jupyter magic.
- PRQL VS Code extension
- prqlc-js — JavaScript bindings forPRQL.
This repo is composed of:
- prqlc — the compiler, written in rust, whose main role is tocompile PRQL into SQL. Also contains the CLI and bindings from variouslanguages.
- web — our web content: theBook,Website, andPlayground.
It also contains our testing / CI infrastructure and development tools. Checkout ourdevelopment docs for more details.
Many thanks to those who've made our progress possible:
About
PRQL is a modern language for transforming data — a simple, powerful, pipelined SQL replacement
Topics
Resources
License
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.