Giter Site home page Giter Site logo

bcho / prql Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prql/prql

0.0 1.0 0.0 11.83 MB

PRQL is a modern language for transforming data — a simple, powerful, pipelined SQL replacement

Home Page: https://prql-lang.org

License: Apache License 2.0

Shell 0.52% JavaScript 4.92% Python 0.52% C 0.50% PHP 1.08% Java 1.52% C# 0.69% Rust 80.84% Elixir 1.29% CSS 4.49% Makefile 0.04% HTML 3.16% Dockerfile 0.43%

prql's Introduction

PRQL

Website Playground Language Docs Discord

GitHub CI Status GitHub contributors Stars

Pipelined Relational Query Language, pronounced "Prequel".

PRQL is a modern language for transforming data — a simple, powerful, pipelined SQL replacement. Like SQL, it's readable, explicit and declarative. Unlike SQL, it forms a logical pipeline of transformations, and supports abstractions such as variables and functions. It can be used with any database that uses SQL, since it compiles to SQL.

PRQL can be as simple as:

from employees
filter country == "USA"                       # Each line transforms the previous result
aggregate [                                   # `aggregate` reduces each column to a value
  max salary,
  min salary,
  count,                                      # Trailing commas are allowed
]

Here's a fuller example of the language;

from employees
filter start_date > @2021-01-01               # Clear date syntax
derive [                                      # `derive` adds columns / variables
  gross_salary = salary + (tax ?? 0),         # Terse coalesce
  gross_cost = gross_salary + benefits_cost,  # Variables can use other variables
]
filter gross_cost > 0
group [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
  ]
)
filter sum_gross_cost > 100_000               # `filter` replaces both of SQL's `WHERE` & `HAVING`
derive id = f"{title}_{country}"              # F-strings like Python
derive country_code = s"LEFT(country, 2)"     # S-strings allow using SQL as an escape hatch
sort [sum_gross_cost, -country]               # `-country` means descending order
take 1..20                                    # Range expressions (also valid here as `take 20`)

For more on the language, more examples & comparisons with SQL, visit prql-lang.org. To experiment with PRQL in the browser, check out PRQL Playground.

Current Status - February 2023

PRQL is being actively developed by a growing community. It's ready to use by the intrepid, either as part of one of our supported extensions, or within your own tools, using one of our supported language bindings.

PRQL continues to evolve toward the 0.5 Milestone. The CHANGELOG.md gives more information.

PRQL still has some minor bugs and some missing features, and probably is only ready to rolled out to non-technical teams for fairly simple queries. We're exploring where to focus further development; we welcome use-cases. Here's our current Roadmap and our longer-term set of Milestones.

Get involved

To stay in touch with PRQL:

  • Follow us on Twitter
  • Join us on Discord
  • Star this repo
  • Contribute — join us in building PRQL, through writing code (send us your use-cases!), or inspiring others to use it.
  • See the development documentation for PRQL. It's easy to get started — the project can be built in a couple of commands, and we're a really friendly community!

Explore

Contributors

Many thanks to those who've made our progress possible:

Contributors

prql's People

Contributors

max-sixty avatar aljazerzen avatar dependabot[bot] avatar richb-hanover avatar pre-commit-ci[bot] avatar vanillajonathan avatar mklopets avatar eitsupi avatar qharlie avatar kiibo382 avatar rog0d avatar blurrechdev avatar kwigley avatar kasvith avatar nkicg6 avatar arrizalamin avatar iafisher avatar snth avatar marinpostma avatar github-actions[bot] avatar bcho avatar shuozeli avatar matthias-q avatar doki23 avatar bcsabaengine avatar fool1280 avatar veenaamb avatar sebastiantoh avatar ruslandoga avatar 1kinoti avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.