Skip to main content

A statically-typed language that compiles to Oracle PL/SQL 19c / 23ai

Project description

pell

A statically-typed language that compiles to Oracle PL/SQL 19c / 23ai. Modern syntax, real type checking, ergonomic SQL — and the emitted PL/SQL is a deployable, human-readable, SHA-anchored artifact you commit, audit, and git blame like any other code.

Install

# Core compiler (zero deps)
pip install pell

# + Oracle driver + REPL (for `pell exec`, `pell repl`, `pell sql`, `pell deploy`)
pip install "pell[repl]"

After install, pell is on your PATH:

pell --help
pell build src/hello.pell
pell repl

One look at the lowering

// src/hr/employees.pell
module hr.employees;

pub record Employee { id: number, name: text, level: number }
pub error NotFound { id: number }

pub fn promote(id: number) -> Result<Employee, NotFound> {
    let row: Employee = sql! {
        select id, name, level from employees where id = :id
    }.one()?;
    return Ok(Employee {
        id:    row.id,
        name:  row.name,
        level: row.level + 1,
    });
}

…lowers to PL/SQL you'd write by hand:

CREATE OR REPLACE PACKAGE hr.employees AS
  TYPE t_employee IS RECORD (
    id    NUMBER,
    name  VARCHAR2(4000),
    level NUMBER
  );
  FUNCTION promote(p_id IN NUMBER) RETURN t_employee;
END employees;
/

CREATE OR REPLACE PACKAGE BODY hr.employees AS
  FUNCTION promote(p_id IN NUMBER) RETURN t_employee IS
    l_row t_employee;
    l_ret t_employee;
  BEGIN
    SELECT id, name, level
      INTO l_row
      FROM employees
     WHERE id = p_id;
    l_ret.id    := l_row.id;
    l_ret.name  := l_row.name;
    l_ret.level := (l_row.level + 1);
    RETURN l_ret;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      RAISE pell_runtime.hr_employees_notfound;
  END promote;
END employees;
/

Features

  • Generics & sum typesResult<T, E>, Option<T>, list<T>
  • Real string interpolation"got {count} tables" with auto-stringify for any type
  • Embedded SQLsql! { ... } with .one() / .collect() / .first() terminators driving the right SELECT INTO shape
  • JSON / regex / jq-style queries — first-class, using Oracle 23ai JSON_OBJECT_T natively
  • Notebook-style REPL — variable persistence across cells, \load files, catalog:: data dictionary helpers
  • Deployment artifact.sql output is SHA-anchored, byte-stable with --reproducible, meant to be committed

Learn more

License

MIT — see 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

pell-0.1.0.tar.gz (127.0 kB view details)

Uploaded Source

Built Distribution

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

pell-0.1.0-py3-none-any.whl (107.5 kB view details)

Uploaded Python 3

File details

Details for the file pell-0.1.0.tar.gz.

File metadata

  • Download URL: pell-0.1.0.tar.gz
  • Upload date:
  • Size: 127.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pell-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8181214f57dfa1e2a638cf516631a6a8284207f8578e281ff8ebdab6f6446f87
MD5 057e86c87f230d47f5d4c0aab7971f45
BLAKE2b-256 ee730f6425b2ea0f98b6181f1212c98c909cc15f7e83fde50cf11dd3fecbee7d

See more details on using hashes here.

File details

Details for the file pell-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pell-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 107.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pell-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17c4b9d6b2d49da4623ab5844836d5824125294b047d11a721b134cd449e2035
MD5 452dd7ae82d2f228c83cb0fa4f674278
BLAKE2b-256 5dffef22f1d428c063f8e0e5495327171226296c28da704294f2f3ea3202e335

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