Lexega analyzes SQL semantically and enforces policy before execution. Same engine whether a developer opens a PR or an AI agent generates a query. One binary. No database connection. No dbt install.
Outputs fit your workflow: PR comments, JSON, YAML, and SARIF for IDE integration. Decision records created for audit.
One "small" SQL change:
- WHERE created_at > DATEADD(day, -30, CURRENT_DATE)That's a removed filter on a DELETE. If that slips through code review, production data is gone. One red line in a git diff is easy to miss—especially in large PRs with many changed files.
At 50+ dbt models, no one has the time to review SQL carefully. PRs get approved with "LGTM" and hope, until production is affected.
In a dbt project:
$ lexega-sql review main..HEAD models/ -r
Decision: BLOCKED (exit code 2)
Signals:
CRITICALDIFF-WRITE-WHERE-RMV: Unbounded Write After WHERE Removed
models/staging/stg_events.sql — DELETE lost WHERE clause, may affect entire table
HIGHDIFF-JOIN-NARROW: JOIN Type Narrowed
models/marts/fct_orders.sql — LEFT → INNER JOIN, may silently drop rowsIn a migrations or infrastructure repo:
$ lexega-sql review main..HEAD migrations/ -r
Decision: BLOCKED (exit code 2)
Signals:
CRITICALMASK-DROP: Masking Policy Dropped
migrations/cleanup.sql — Column data protection removed
HIGHGRT-ALL-PRIV: Grant All Privileges
migrations/permissions.sql — Use specific grants, not ALL PRIVILEGESSignals are informational. In CI/CD, a policy produces a decision artifact (and exit code) you can gate on—before it reaches production.
Lexega turns SQL diffs into actionable risk: understand what changed, classify the impact, and enforce policy automatically.
{{ ref('orders') }} becomes the actual table reference—without Python or dbt installeddiff / review, it compares semantic models between branches—not text, but meaningSame binary, same rules, same decision schema. The policy doesn't care who wrote the SQL—it evaluates the query and renders a verdict. CI writes the decision to a file for audit. Agent runtime writes it to stdout for immediate action.
Review SQL changes between commits. Gate merges on policy.
lexega-sql review main..HEAD -r --pr-commentCheck AI-generated SQL before execution.
lexega-sql analyze --stdin --mode runtimeWe analyzed a 3,300+ model dbt project (GitLab’s public Analytics dbt repo) to stress-test detection at real-world scale:
123 critical-severity findings—JOIN changes, NULL logic hazards, filter removals—each one a potential incident that Lexega could have prevented.
These are detections from static analysis and semantic diff signals; your policy decides what blocks vs warns.
The scaffolded policy blocks critical, warns on high, and allows the rest. Tune policies by severity, environment, path, and rule as needed.
YAML policies define what's blocked, warned, or allowed. Store them in the repo or your cloud storage provider of choice.
PR comments, JSON/YAML for tooling, SARIF for IDE integration.
Decision records capture which policies were evaluated and what changes triggered the outcome.
# .github/workflows/sql-review.yml
on: [pull_request]
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- run: lexega-sql review $BASE..$HEAD . -r --pr-comment
env:
LEXEGA_LICENSE_KEY: ${{ secrets.LEXEGA_LICENSE_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Exit code 2 = blocked, 0 = passedBlock PRs that violate policy with a single binary. No dependencies. Your rules, enforced automatically.
Unbounded writes, JOIN changes, dropped filters, masking policy removals, privilege grants—covered out of the box
Compares meaning between branches, not text. Tables, joins, filters, column lineage
Detects security-relevant changes: dropped policies, credential changes, privilege escalations, encryption removal, RLS/column security bypass
Analyze SQL in Python files, Jupyter notebooks, and Databricks notebooks. AST-based extraction—no regex heuristics
Define organization-specific rules and enforcement in YAML. Block patterns, require tags, enforce encryption—with IDE autocomplete
Renders templates without Python. ref(), var(), macros just work
Decision records capture which policies were evaluated, what changed, and why the merge was blocked or allowed
Built first for data platform and analytics engineering teams who need to control what’s allowed to run in production—before it runs.
Full functionality. Run it on your repo, see what it catches. Self-serve install.
Install (macOS / Linux):
curl -sSL https://lexega.com/install.sh | shFormatting is free forever. Trial key unlocks risk analysis.
Go production-ready with dedicated onboarding. Pilot fee credited 100% toward your annual license.
Success criteria we define together: CI integration on 2+ repos, policy blocking in prod, team reviewing signals.
Start Pilot Conversation →Questions? support@lexega.com · We respond within 24 hours.