#sql-query #jsonnet #configuration-language #express #representation #templated

sqlsonnet

Express SQL queries with a simple Jsonnet representation, which can be easily templated using the Jsonnet configuration language

1 unstable release

0.1.14 Feb 28, 2025

#576 in Configuration

Download history 140/week @ 2025-02-26

140 downloads per month

MIT/Apache

95KB
1.5K SLoC

Express SQL queries with a simple Jsonnet representation, which can be easily templated using the Jsonnet configuration language.

See the main README in the repository root.


lib.rs:

Usage from Rust

use sqlsonnet::{Query, sqlsonnet_query, jsonnet::Options};
// This performs compile-time syntax checking
let query: Query = sqlsonnet_query!({ select: { fields: ["name", "age"], from: "contacts" } }).unwrap();
// Convert to SQL
assert_eq!(query.to_sql(true), "SELECT name, age FROM contacts");

Dependencies

~9–19MB
~243K SLoC