Giter Club home page Giter Club logo

cupatea / prql Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prql/prql

0.0 0.0 0.0 18.41 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.37% JavaScript 4.85% C++ 0.51% Python 0.34% C 0.66% PHP 1.19% Java 1.15% C# 1.24% Rust 81.13% Elixir 0.95% TypeScript 0.81% CSS 3.41% Nix 0.16% Makefile 0.08% HTML 2.45% Handlebars 0.03% Dockerfile 0.08% Zig 0.45% Just 0.15%

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 tracks
filter artist == "Bob Marley"                 # Each line transforms the previous result
aggregate {                                   # `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;

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 - October 2023

PRQL is being actively developed by a growing community. It's ready to use by the 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 ready to be rolled out to non-technical teams for fairly simple queries.

We released 0.9.0, in July, our biggest ever release. Here's our current Roadmap.

Our immediate focus for the code is on:

  • Ensuring our supported features feel extremely robust; resolving any priority 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 all standard SQL queries; for example date to string functions.
  • Expanding our set of supported features — we've recently added experimental support 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 building integrations with tools that folks already use; for example our VS Code extension & Jupyter integration. If there are tools you're familiar with that you think would be open to integrating with PRQL, please let us know in an issue.
  • Whether all our initial decisions were correct — for example how we handle window functions outside of a window transform.
  • Making it easier to contribute to the compiler. We have a wide group of contributors to the project, but contributions to the compiler itself are quite concentrated. We're keen to expand this; #1840 for feedback, some suggestions on starter issues are below.

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!
  • For those who might be interested in contributing to the code now, check out issues with the good first issue label. Always feel free to ask questions or open a draft PR.

Explore

Repo organization

This repo is composed of:

  • prql-compiler — the compiler, written in rust, whose main role is to compile PRQL into SQL.
  • prqlc — A single binary command line tool for prql-compiler, written in rust.
  • web — our web content: the Book, Website, and Playground.
  • bindings — bindings from various languages to prql-compiler.

It also contains our testing / CI infrastructure and development tools. Check out our development docs for more details.

Contributors

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

Contributors

prql's People

Contributors

max-sixty avatar aljazerzen avatar dependabot[bot] avatar eitsupi avatar vanillajonathan avatar not-my-profile avatar pre-commit-ci[bot] avatar richb-hanover avatar mklopets avatar qharlie avatar jelenkee avatar kiibo382 avatar rog0d avatar bcho avatar github-actions[bot] avatar blurrechdev avatar kwigley avatar kasvith avatar nkicg6 avatar aaronmoat avatar arrizalamin avatar iafisher avatar matthias-q avatar marinpostma avatar shuozeli avatar philpep avatar vthriller avatar hulxv avatar doki23 avatar bcsabaengine 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.