Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yazaldefilimone/spipe
An efficient pipe-powered SQL compiler
https://github.com/yazaldefilimone/spipe
compiler rust sql
Last synced: 26 days ago
JSON representation
An efficient pipe-powered SQL compiler
- Host: GitHub
- URL: https://github.com/yazaldefilimone/spipe
- Owner: yazaldefilimone
- License: apache-2.0
- Created: 2024-08-25T12:42:45.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-09-02T14:51:10.000Z (2 months ago)
- Last Synced: 2024-10-12T05:11:44.888Z (26 days ago)
- Topics: compiler, rust, sql
- Language: Rust
- Homepage:
- Size: 131 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
This compiler simplifies complex SQL with pipe syntax, enabling step-by-step query building that auto-generates native SQL. It includes a checker for readability, performance tips, and diagnostics to catch errors, making SQL writing and maintenance effortless.
Example:
with pipe syntax:
```sql
FROM orders
|> JOIN customers ON orders.customer_id = customers.customer_id
|> WHERE orders.total_amount > (SELECT AVG(total_amount) FROM orders)
|> AGGREGATE COUNT(order_id) AS num_orders
GROUP BY customers.customer_name;
```to native SQL:
```sql
SELECT COUNT(orders.order_id) AS num_orders
FROM orders
JOIN customers ON orders.customer_id = customers.customer_id
WHERE orders.total_amount > (SELECT AVG(total_amount) FROM orders)
GROUP BY customers.customer_name;
```with pipe syntax:
```sql
FROM employees
|> JOIN departments ON employees.dept_id = departments.id
|> WHERE employees.salary > 50000
|> ORDER BY employees.salary DESC
LIMIT 5;
```to native SQL:
```sql
SELECT *
FROM employees
JOIN departments ON employees.dept_id = departments.id
WHERE employees.salary > 50000
ORDER BY employees.salary DESC
LIMIT 5;```
checker diagnostics exemple:
![example](./example.png)
----
[paper](https://research.google/pubs/sql-has-problems-we-can-fix-them-pipe-syntax-in-sql/)