Open Edition

Lexega's SQL front-end, recognition engine, rule corpus and command line are source-available. The repository is github.com/Lexega/lexega, and every release carries a binary built from it: lexega.

What is in the repository

PartWhat it is
crates/lexega-syntaxLexer, parser, AST/CST and formatter for Snowflake, PostgreSQL, BigQuery, MySQL, MSSQL, Databricks and Redshift
crates/lexega-coreThe recognition engine: relational plan, statement facts, rule evaluator, reports
crates/lexega-cliThe lexega binary and the catalog sidecars catalog pull runs
rules/The built-in rule corpus, as YAML

Get it

Download lexega for your platform from GitHub Releases, next to lexega-sql:

PlatformFile
Linux x64 / ARM64lexega-linux-x64, lexega-linux-arm64
macOS Intel / Apple Siliconlexega-darwin-x64, lexega-darwin-arm64
Windows x64 / ARM64lexega-windows-x64.exe, lexega-windows-arm64.exe

CHECKSUMS.sha256 in the same release covers each file, and each binary has an SBOM beside it.

Or build it from source, with Rust 1.91 or later:

git clone https://github.com/Lexega/lexega
cd lexega
cargo build --release --bin lexega

What it does

lexega has the analyze, review, ci, catalog and fmt commands this documentation describes for lexega-sql, with every built-in rule and dialect, custom rules, catalog snapshots, cloud storage locations, SARIF and GitLab SAST output, and PR comments. Its flags are the same, apart from those of the features listed below.

lexega analyze models/ -r --min-severity medium
lexega analyze --format sarif query.sql > results.sarif
lexega review origin/main..HEAD --pr-comment

It analyzes each statement as written. That is the depth lexega-sql runs at without a license key, and the two report the same findings.

What it leaves out

  • Semantic analysis. Analysis across scopes, statements and scripts: nullability, constraint propagation, lineage, taint, dynamic-SQL resolution, cross-statement schema state. 52 of the 930 built-in rules read facts that only this analysis fills; in lexega they stay silent or report less precisely, and every report says how many rules that affects.
  • Semantic diff. There is no diff command, so the 73 DIFF-* rules never fire.
  • dbt and Jinja rendering. Templates are analyzed as written and reported as not rendered.
  • Policy enforcement. No --policy, decision records or exceptions. analyze, review and ci exit 0 when the analysis ran, whatever it found.
  • The dashboard, runtime mode and cross-script analysis.

An option that needs one of these is refused with a message naming it. A custom rule sees the same facts a built-in rule sees, so a rule file cannot stand in for the missing analysis. All of the above is in lexega-sql with a license key; see Pricing.

License

The repository is offered under the Business Source License 1.1: free to use, modify and redistribute, in production too, for any purpose other than a Competing Use. Each version becomes available under the Apache License 2.0 four years after its release.

Need Help?

Can't find what you're looking for? Check out our GitHub or reach out to support.