Skip to main content

An interpreted relational query language that compiles to SQL

Project description

alt text

Preql (pronounced: Prequel) is an interpreted relational query language.

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

  • Compiles to SQL at runtime. It has the performance and abilities of SQL, and much more.

    • Support for Postgres, MySQL and Sqlite. (more planned!)

    • Escape hatch to SQL, for all those database-specific features we didn't think to include

  • Programmer-friendly syntax and semantics, with gradual type-checking, inspired by Typescript and Python

  • Interface through Python, HTTP or a terminal environment with autocompletion

Note: Preql is still work in progress, and isn't ready for production use, or any serious use yet

Documentation

Read here

Get started

Simply install via pip:

    pip install -U preql-lang

Then just run the interpreter:

    preql

Requires Python 3.8+

Read more

Quick Example

// Sum up all the squares of an aggregated list of numbers
// Grouped by whether they are odd or even
func sqrsum(x) = sum(x * x)
func is_even(x) = x % 2 == 0

print [1..100]{
        is_even(item) => sqrsum(item)
      }
// Result is:
┏━━━━━━━━━┳━━━━━━━━┓
 is_even  sqrsum 
┡━━━━━━━━━╇━━━━━━━━┩
       0  166650 
       1  161700 
└─────────┴────────┘

In the background, this was run by executing the following SQL code (reformatted):

  WITH range1 AS (SELECT 1 AS item UNION ALL SELECT item+1 FROM range1 WHERE item+1<100)
     , subq_3(is_even, sqrsum) AS (SELECT ((item % 2) = 0) AS is_even, SUM(item * item) AS sqrsum FROM range1 GROUP BY 1)
  SELECT * FROM subq_3

License

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

See: LICENSE

In simple words, 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.

If you want to add the Preql language interface as a user-facing part of your commercial product, contact us for a commercial license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

preql-lang-0.1.16.tar.gz (72.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

preql_lang-0.1.16-py3-none-any.whl (81.7 kB view details)

Uploaded Python 3

File details

Details for the file preql-lang-0.1.16.tar.gz.

File metadata

  • Download URL: preql-lang-0.1.16.tar.gz
  • Upload date:
  • Size: 72.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.2 CPython/3.8.2 Windows/10

File hashes

Hashes for preql-lang-0.1.16.tar.gz
Algorithm Hash digest
SHA256 0bcc46d4287f4c65ddf2f6e0d883a7548c9c7a7261e8ea91adfd38d93323aaa8
MD5 20ab9ae798717a8e3303c485405f09e6
BLAKE2b-256 c4a37f376ea14e5c9ec54ab2177e7b656d9eebd623a676931b3d0d521d213414

See more details on using hashes here.

File details

Details for the file preql_lang-0.1.16-py3-none-any.whl.

File metadata

  • Download URL: preql_lang-0.1.16-py3-none-any.whl
  • Upload date:
  • Size: 81.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.2 CPython/3.8.2 Windows/10

File hashes

Hashes for preql_lang-0.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 1775ceb669746b3d4eadb07e31a91cfa01b8c1afda299560ccb6fb3ac42d0f61
MD5 9f7b818d28c9d25464aaa7522d8b6745
BLAKE2b-256 7b54a90111355a04552425b29186cd9ca7447554550bfd27af1791e36cbe03c7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page