On this page:
2.1 Project Status
2.2 The Example Database Schema
2.3 Strings vs Procedures
2.4 Environment Setup
7.7

2 Getting Started

2.1 Project Status

Plisqin is highly experimental and may introduce breaking changes at any time.

Plisqin’s ideal scope is Create, Read, Update, and Delete (CRUD). Currently, only Read is supported, and even this support is incomplete. Missing features include top/limit, distinct, union, and window functions.

Out of scope is what I call "DBA-level SQL" such as create index which has never really been a pain point for me.

In its hypothetical final form, Plisqin is an alternate query language supported natively by the RDBMS, bypassing SQL entirely.

2.2 The Example Database Schema

This documentation uses an example database schema, the Video Rental Example Schema which models a brick-and-mortar video rental store (think pre-Netflix). When you see an upper-case identifier such as Rental it almost certainly links to the documentation of this example schema, which might help you if you don’t understand a query.

This database diagram might be useful to have while reading this document.

If you want to follow along using a local database, the following scripts will create the tables:

2.3 Strings vs Procedures

Here is a simple query in Plisqin:
(from r "Rental"
      (where r".RentalId > 100"))
The details of our database schema are in strings, namely the "Rental" table and the "RentalId" column. An alternative style is to encode our database schema into Racket procedures. Here is an [almost] equivalent query:
(from r Rental
      (where (RentalId r)" > 100"))
The details of this 2nd style won’t be explained until the Layer 1 - Schema as Procedures section, but any section of this guide might use either style, depending on what is convenient.

2.4 Environment Setup

To try out Plisqin, you need Racket installed. You can download Racket here.

Once you have Racket installed, run raco pkg install plisqin from your command line. This should download and setup the plisqin package.

Now start DrRacket. You should have a file that contains one line: #lang racket. This line should be at the top of every Racket file you write. Now paste the following code below #lang racket
(require plisqin)
(display (to-sql (from f "Foo")))
When you run the program (Ctrl+R), you should see an SQL query: select f.* from Foo f