All Projects → erezsh → Preql

erezsh / Preql

Licence: other
An interpreted relational query language that compiles to SQL.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Preql

Sqldb Logger
A logger for Go SQL database driver without modify existing *sql.DB stdlib usage.
Stars: ✭ 160 (-37.74%)
Mutual labels:  sql, query, database
Web Database Analytics
Web scrapping and related analytics using Python tools
Stars: ✭ 175 (-31.91%)
Mutual labels:  data-science, sql, database
Awesome Business Intelligence
Actively curated list of awesome BI tools. PRs welcome!
Stars: ✭ 1,157 (+350.19%)
Mutual labels:  data-science, sql, database
Laravel Db Profiler
Database Profiler for Laravel Web and Console Applications.
Stars: ✭ 141 (-45.14%)
Mutual labels:  sql, query, database
Query Exporter
Export Prometheus metrics from SQL queries
Stars: ✭ 166 (-35.41%)
Mutual labels:  sql, query, database
Data Science Best Resources
Carefully curated resource links for data science in one place
Stars: ✭ 1,104 (+329.57%)
Mutual labels:  data-science, sql, database
Trino
Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
Stars: ✭ 4,581 (+1682.49%)
Mutual labels:  data-science, sql, database
Pygm
🐍 Python library implementing sorted containers with state-of-the-art query performance and compressed memory usage
Stars: ✭ 156 (-39.3%)
Mutual labels:  data-science, database
Pydbgen
Random dataframe and database table generator
Stars: ✭ 191 (-25.68%)
Mutual labels:  data-science, database
Elastic
R client for the Elasticsearch HTTP API
Stars: ✭ 227 (-11.67%)
Mutual labels:  data-science, database
Roapi
Create full-fledged APIs for static datasets without writing a single line of code.
Stars: ✭ 253 (-1.56%)
Mutual labels:  sql, query
Data Science Question Answer
A repo for data science related questions and answers
Stars: ✭ 2,000 (+678.21%)
Mutual labels:  data-science, sql
Griffon Vm
Griffon Data Science Virtual Machine
Stars: ✭ 128 (-50.19%)
Mutual labels:  data-science, database
Torchbear
🔥🐻 The Speakeasy Scripting Engine Which Combines Speed, Safety, and Simplicity
Stars: ✭ 128 (-50.19%)
Mutual labels:  data-science, database
Blazingsql
BlazingSQL is a lightweight, GPU accelerated, SQL engine for Python. Built on RAPIDS cuDF.
Stars: ✭ 1,652 (+542.8%)
Mutual labels:  data-science, sql
Bedquilt Core
A JSON document store on PostgreSQL
Stars: ✭ 256 (-0.39%)
Mutual labels:  sql, database
Questdb
An open source SQL database designed to process time series data, faster
Stars: ✭ 7,544 (+2835.41%)
Mutual labels:  sql, database
H2database
H2 is an embeddable RDBMS written in Java.
Stars: ✭ 3,078 (+1097.67%)
Mutual labels:  sql, database
Dataux
Federated mysql compatible proxy to elasticsearch, mongo, cassandra, big-table, google datastore
Stars: ✭ 268 (+4.28%)
Mutual labels:  sql, database
Nodejs Bigquery
Node.js client for Google Cloud BigQuery: A fast, economical and fully-managed enterprise data warehouse for large-scale data analytics.
Stars: ✭ 268 (+4.28%)
Mutual labels:  sql, database

alt text

Preql is an interpreted, relational programming language, that specializes in database queries.

It is designed for use by data engineers, analysts and data scientists.

Preql's main objective is to provide an alternative to SQL, in the form of a high-level programming language, with first-class functions, modules, strict typing, and Python integration.

How does it work?

Preql code is interpreted and gets compiled to SQL at runtime. This way, Preql gains the performance and abilities of SQL, but can also operate as a normal scripting language.

Currently supported dialects are:

  • Postgres
  • MySQL
  • Sqlite
  • BigQuery (WIP)
  • More... (planned)

For features that are database-specific, or aren't implemented in Preql, there is a SQL() function that provides a convenient escape hatch to write raw SQL code.

Main Features

  • Modern syntax and semantics
    • Interpreted, everything is an object
    • Strong type system with gradual type validation and duck-typing
  • Compiles to SQL
  • Python and Pandas integration
  • Interactive shell (REPL) with auto-completion
  • Runs on Jupyter Notebook

Note: Preql is still work in progress, and isn't yet recommended for use in production.

tests

Learn More

Get started

Simply install via pip:

    pip install -U preql-lang

Then just run the interpreter:

    preql

Requires Python 3.6+

Read more

Quick Example

// Declare a new table
table Continent {
    name: string
    area: int       // km²
    population: int
}

// Initialize the table, by inserting rows
new Continent("Africa", 30370000, 1287920000)
new Continent("Antarctica", 14000000, 4490)
new Continent("Asia", 44579000, 4545133000)
new Continent("Europe", 10180000, 742648000)
new Continent("North America", 24709000, 587615000)
new Continent("South America", 17840000, 428240000)
new Continent("Australia", 8600000, 41261000)

// Print the continents, ordered by density
print Continent {
    ...                         // Include existing fields
    density: population / area  // Create new a field

} order{^density}

// Print the total land area
print "Total land area:", sum(Continent{area}), "km²"

//  ========================= Output ==========================

                              table  =7
┏━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
 id  name               area  population                density 
┡━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
  3  Asia           44579000  4545133000      101.9568182328002 
  4  Europe         10180000   742648000       72.9516699410609 
  1  Africa         30370000  1287920000      42.40763911755021 
  6  South America  17840000   428240000     24.004484304932735 
  5  North America  24709000   587615000     23.781415678497712 
  7  Australia       8600000    41261000      4.797790697674419 
  2  Antarctica     14000000        4490  0.0003207142857142857 
└────┴───────────────┴──────────┴────────────┴───────────────────────┘

Total land area: 150278000 km²

In the background, this table was generated by executing the following compiled SQL code (reformatted):

-- Continent {..., density: population / area} order{ ^density }
WITH subq_1(id, name, area, population, density) AS (
    SELECT id, name, area, population, (CAST(population AS float) / area) AS density
    FROM Continent
    ORDER BY density DESC)
SELECT * FROM subq_1

See more examples in the examples folder.

Interactive Environment

Screenshot.png

License

Preql uses an “Interface-Protection Clause” on top of the MIT license.

See: LICENSE

In simple words, it's free for personal use. Also, it can be used for any commercial or non-commercial purpose, as long as your product doesn't base its value on exposing the Preql language itself to your users. Read more

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].