Skip to content

Commit 3430938

Browse files
committed
Document a comparison with other tools
1 parent d245619 commit 3430938

4 files changed

Lines changed: 70 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ There are implementations of CEL for [Go](https://github.com/google/cel-go), [Ja
3434

3535
Moreover, the CEL specification is simpler than the jqlang specification. If you need something less powerful than `jq` or Python, then `celq` might be what you are looking for.
3636

37+
Check our [comparison with other tools](https://docs.rs/celq/latest/celq/comparison_with_other_tools) for more details.
38+
3739
## Installation
3840

3941
### Pre-built Binaries
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
## jq vs celq
2+
3+
* [jq](https://github.com/jqlang/jq) uses jqlang. It is a very powerful language, but it requires learning a new syntax. [Meanwhile, celq uses the Common Expression Language (CEL)](https://cel.dev/) which is a very constrained language that tries to have a similar syntax to C and JavaScript.
4+
* jq did not support JSON5, YAML, and TOML when celq was originally written.
5+
* jq uses pretty-print by default. Meanwhile, celq uses compact output by default.
6+
* jqlang programs can be reused in Python with a library of the same name ([jq](https://pypi.org/project/jq/)). CEL programs can be reused in Python with [cel-python](https://pypi.org/project/cel-python/).
7+
* jqlang programs can be reused in Go with [gojq](https://github.com/itchyny/gojq). CEL programs can be reused in Go with [cel-go](https://github.com/google/cel-go)
8+
* Other languages generally can embed jqlang with `libjq`. For CEL, that can be done with [cel-cpp](https://github.com/google/cel-cpp) or CEL ports in their respective languages.
9+
* Until benchmarks come out, assume that jq is faster than celq.
10+
* celq can process JSON Lines in parallel, while jq cannot.
11+
* gojq and celq are memory-safe, while jq is not (unless compiled with [Fil-C](https://fil-c.org/))
12+
13+
## yq vs celq
14+
15+
* [yq](https://github.com/mikefarah/yq/) supports formats like XML and HCL that celq does not.
16+
* yq's syntax is inspired by jqlang.
17+
* [yqlib](https://pkg.go.dev/github.com/mikefarah/yq/v4/pkg/yqlib) can be reused in Golang only.
18+
* yq is less hermetic than celq by default. That can be mitigated with the `--security-disable-env-ops ` and `--security-disable-file-ops` flags
19+
20+
## jaq vs celq
21+
22+
* [jaq](https://github.com/01mf02/jaq) uses jqlang, as it is a Rust clone of `jq`
23+
* jqlang can be reused in Rust with [jaq-std](https://crates.io/crates/jaq-std). CEL can be reused in Rust with [cel-rust](https://crates.io/crates/cel/0.12.0).
24+
* jaq supports formats like XML and CBOR that celq does not support.
25+
* jaq did not support JSON5 when `celq` was originally written (but this could trivially be added to jaq)
26+
* Until benchmarks come out, assume that jaq is faster than celq
27+
* celq can process JSON Lines in parallel, while jaq cannot (but this could trivially be added to jaq)
28+
* jaq and celq are both memory-safe
29+
30+
31+
## jo vs celq
32+
33+
* [jo](https://github.com/jpmens/jo) is less verbose than celq for creating JSON output from the CLI
34+
* jo doesn't read from the input by default. celq needs the `-n` flag to ignore the input.
35+
* jo can created nested objects by composing calls e.g. `jo github=$(jo user=get-celq repo=homebrew-tap)`. At the moment, celq's arguments don't support maps yet
36+
37+
## gron vs celq
38+
39+
* gron can make HTTP calls by default. celq does not and needs `curl example.com | celq`.
40+
* celq can use the `--greppable` flag to achieve the same behavior as gron
41+
* celq can use the `--from-gron` flag to achieve the same behavior as ungron
42+
* gron has been rewritten in C++, see [fastgron](https://github.com/adamritter/fastgron).
43+
* gron did not support JSON5 when celq was originally written.
44+
45+
## jsonnet vs celq
46+
47+
* jsonnet has its own syntax with functions, imports, inheritance. celq on the other hand is more constrained and uses CEL.
48+
* celq can template simple JSON outputs, especially with the `--from-file` flag. It can substitute jsonnet for simple use cases.
49+
* [jsonnet has a warning against server-side evaluation](https://jsonnet.org/ref/bindings.html#server_side). CEL was invented to prevent that kind of issue.
50+
51+
## jql vs celq
52+
53+
* [jql](https://github.com/yamafaktory/jql) uses its own syntax to query JSON with selectors. celq is closer to how imperative programming languges access JSON fields.
54+
* jql did not support JSON5, YAML, and TOML when celq was originally written.
55+
56+
## DuckDB JSON vs celq
57+
58+
* [DuckDB](https://duckdb.org/docs/stable/data/json/overview) excels at querying JSON with schemas using SQL
59+
* celq and jq excel at querying unstructed JSON
60+
* DuckDB did not support JSON5, YAML, and TOML when celq was originally written (and that is probably a good thing)

docs/manual.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Want to try `celq` without installing anything? Visit the [celq-playground](http
8787

8888
- [CEL Language Definition](https://github.com/google/cel-spec/blob/master/doc/langdef.md)
8989
- [cel-rust](https://github.com/cel-rust/cel-rust): the Rust implementation of CEL powering `celq`
90+
- [Comparison with other tools](`crate::comparison_with_other_tools`)
9091

9192
## Inspiration
9293

src/documentation.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33

44
//! # Other Guides
55
//! [Installation Guide](`crate::installation_guide`)
6+
//!
7+
//! [Comparison with other tools](`crate::comparison_with_other_tools`)
68
pub mod installation_guide {
79
//! # celq Installation Guide
810
#![doc = include_str!("../docs/installation_guide.md")]
911
}
12+
13+
pub mod comparison_with_other_tools {
14+
//! # Comparison with other tools
15+
#![doc = include_str!("../docs/comparison_with_other_tools.md")]
16+
}

0 commit comments

Comments
 (0)