Declarative, typed query lanuage.
Project description
PreQL
Preql [Pre-quel] is a declarative, typed language that compiles to SQL [sequel].
Why?
SQL is fantastic.
SQL has been the de-facto language for working with data for decades. Data professionals can use a common, declarative syntax to interact with anything from local file based databases to global distributed compute clusters.
SQL solves the wrong problem.
SQL is a declarative language for reading and manipulating data in tables in SQL databases.
This is a perfect fit for an application interacting with a datastore.
But in data warehouses, a table is an leaky abstraction. Users actually want to declare conceptual queries. Seeing revenue by product line is a goal; the table that contains the products and the table that contains revenue are implementation details.
This mismatch between what is being declared leads to a sprawling mass of SQL that is duplicative an hard to follow and is critical to business function. Fortune 500 companies spend millions of dollars trying to reverse engineer the original intent of SQL to document dataflwo or lineage, or to refactor business logic when moving to a new database.
How PreQL solves this
PreQL separates declared conceptual manipulation - [Profit] = [Revenue] - [Cost] from the database that implements those concepts and executes queries. This allows conceptual manipulation to be strongly typed and validated through static analysis, which can then be explicitly tested against the declared concrete datasources to produce empirical proof of correctness. Additionally, the two definitions can be independently evolved over time.
A new analyst in a company can be productive in PreQL in minutes; a new analyst with SQL might take a month to understand which tables are relevant.
SQL
USE AdventureWorks;
SELECT t.Name, SUM(s.SubTotal) AS [Sub Total],
STR(Sum([TaxAmt])) AS [Total Taxes],
STR(Sum([TotalDue])) AS [Total Sales]
FROM Sales.SalesOrderHeader AS s
INNER JOIN Sales.SalesTerritory as t ON
s.TerritoryID = t.TerritoryID
GROUP BY t.Name
ORDER BY t.Name
PreQL
SELECT
territory_name,
sub_total,
total_taxes,
total_sales
order by territory_name desc
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for pypreql-0.0.1rc1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b166f6db32881e21d9a0d92994bd839d1dbdbf410502c5a57874f4e1195f11ce |
|
MD5 | f78a0470d4d4d8b9e3709540389e2252 |
|
BLAKE2b-256 | a546240f6bafe2b325bb2dc4d90deaf2f724787e7adc47fd006823e0137f6591 |