- Notifications
You must be signed in to change notification settings - Fork0
PRQL is a modern language for transforming data — a simple, powerful, pipelined SQL replacement
License
mwatts/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 fuller 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 being actively developed by a growing community. It's ready to use bythe intrepid, either with our supported integrations, or within 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.
We released0.11.0 inDecember. It contains three new packages of standard functions — date,text&math — as well as smaller improvements and lots of internal work on ourcompiler. Here's our currentRoadmap.
Our immediate focus for the code is on:
- 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've recently added experimentalsupport for modules / multi-file projects, and for auto-formatting.
We're also spending time thinking about:
- Making it really easy to start using PRQL. We're doing that by buildingintegrations with tools that folks already use; for example our VS Codeextension & Jupyter integration. If there are tools you're familiar with thatyou think would be open to integrating with PRQL, please let us know in anissue.
- 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.
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
- prql-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
Resources
License
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Languages
- Rust83.7%
- JavaScript4.2%
- CSS2.8%
- HTML2.2%
- C#1.1%
- PHP1.0%
- Other5.0%