A language for tabular data

Data pipelines that read top to bottom.

Grizzly is a small language for transforming tabular data. Tables are values, transformations are functions, and pipes chain them in the order they run.

pipeline.griz
staff = table [
  name  | dept    | salary,
  "Ana" | "eng"   | 60000,
  "Bo"  | "eng"   | 45000,
  "Cy"  | "sales" | 70000
];

staff |> filter(salary > 50000) |> print;
output
name | dept  | salary
-----+-------+-------
Ana  | eng   | 60000
Cy   | sales | 70000

Principles

Read order is execution order

No clause order to memorize. Each step follows the one before it.

Functions over keywords

filter, join, and sum are ordinary functions, so your own transformations look like built-ins.

Pipes, not nesting

x |> f(a) means f(x, a). Long pipelines stay flat.

Row context

Inside a verb, column names are plain values for the current row. No vector types, no broadcasting.

Compared

The same transformation in Grizzly, SQL, and pandas.

Grizzly

staff
  |> filter(salary > 50000)
  |> filter(dept != "ops");

SQL

SELECT *
FROM staff
WHERE salary > 50000
  AND dept != 'ops';

pandas

staff[
  (staff.salary > 50000)
  & (staff.dept != "ops")
]

Grizzly

employees
  |> filter(salary > 40000)
  |> group_by(dept)
  |> summarize(total: sum(salary))
  |> sort(total, desc);

SQL

SELECT dept, SUM(salary) AS total
FROM employees
WHERE salary > 40000
GROUP BY dept
ORDER BY total DESC;

pandas

(employees
  .query("salary > 40000")
  .groupby("dept", as_index=False)
  .agg(total=("salary", "sum"))
  .sort_values("total",
               ascending=False))

Grizzly

orders
  |> join(customers,
       on: customer_id,
       how: left)
  |> select(order_id, name, amount);

SQL

SELECT o.order_id, c.name, o.amount
FROM orders o
LEFT JOIN customers c
  ON o.customer_id = c.customer_id;

pandas

(orders
  .merge(customers, on="customer_id",
         how="left")
  [["order_id", "name", "amount"]])

Grizzly

employees
  |> add_col(bonus: salary * 0.1)
  |> filter(bonus > 5000);

SQL

SELECT *, salary * 0.1 AS bonus
FROM employees
WHERE salary * 0.1 > 5000;

pandas

(employees
  .assign(bonus=lambda d:
          d.salary * 0.1)
  .query("bonus > 5000"))

Grizzly

employees
  |> sort(salary, desc)
  |> head(3)
  |> select(name, salary);

SQL

SELECT name, salary
FROM employees
ORDER BY salary DESC
LIMIT 3;

pandas

(employees
  .sort_values("salary",
               ascending=False)
  .head(3)
  [["name", "salary"]])

Tools

CLI and REPL

Run .griz files or explore interactively with grizzly.

Jupyter

A kernel for notebooks. Setup

VS Code

Syntax highlighting for .griz files. Extension

Playground

The interpreter in your browser via WebAssembly. Open

Get started

cargo install --git https://github.com/andrianllmm/grizzly
grizzly pipeline.griz   # run a file
grizzly                 # start the REPL