#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

new 0.1.14 Feb 28, 2025

#646 in Configuration

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
~245K SLoC