You are looking at historical revision 45764 of this page. It may differ significantly from its current revision.

ORM-DB-rqlite

rqlite backend for the orm abstract database interface.

Description

orm-db-rqlite implements the orm-db backend protocol against rqlite, a lightweight, distributed relational database built on SQLite that is accessed over HTTP. It provides a single constructor, rqlite-backend, which returns a backend alist suitable for db/backend. Because rqlite speaks SQLite SQL, this backend reuses the sqlite3 ssql dialect.

The connection is stateless: each query and statement is sent as an HTTP request to the rqlite cluster, so there is no persistent socket to manage — db/close is a no-op.

Requirements

Installation

chicken-install orm-db-rqlite

Basic Usage

(import orm-db orm-db-rqlite orm)

;; Select the backend; db/path is the rqlite HTTP base URL
(db/backend (rqlite-backend))
(db/path "http://localhost:4001")
(db/connect)

(define-model users)
(users/all)

(db/close)   ; no-op for rqlite

The db/path value is the base HTTP URL of the rqlite node, optionally including credentials. Requests are issued against the /db/request endpoint with the timings and associative options.

;; With basic-auth credentials and TLS
(db/path "https://user:pass@db.example.com:4001")

API

[procedure] (rqlite-backend)

Returns a backend alist implementing the orm-db protocol — the keys connect, close, query, and execute — backed by rqlite's HTTP API. Pass the result to db/backend.

(db/backend (rqlite-backend))

The backend procedures are used by orm-db; you do not normally call them directly:

SQL Dialect

The backend includes the sqlite3 ssql dialect and registers an rqlite dialect that delegates to it, so ssql S-expression forms render as SQLite-compatible SQL. Raw SQL strings are passed through unchanged.

Notes on Distributed Use

License

Copyright © 2026 Rolando Abarca. Released under the BSD-3-Clause license.

Repository

Part of the chicken-orm-egg project. See orm for the ORM itself.