#sql #jsonnet #checking #sqlsonnet

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

#2237 in Parser implementations

MIT/Apache

95KB
1.5K SLoC

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");

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.

Dependencies

~7–18MB
~235K SLoC