Four steps from a license key to findings on a pull request, where the whole team sees them. No key yet? Start a trial.
One program, checked against the release checksums.
curl -sSL https://lexega.com/install.sh | shFree to run. No key, no account, no email. macOS and Linux; Windows download.
On your machine, run this and paste the key when prompted:
lexega-sql license activateIn CI, store the key as a repository secret named LEXEGA_LICENSE_KEY. The key is checked offline; the runner needs no network access to Lexega.
From the repository root, with your dialect:
lexega-sql init --dialect snowflakeIt analyzes every SQL file once and writes .lexega/: a baseline policy that warns on critical and high findings and blocks nothing, an empty exceptions file, a baseline SARIF report and a directory for decision records. Commit it. The other dialects are mssql, postgresql, bigquery, mysql, databricks and redshift.
Add this workflow as .github/workflows/lexega.yml, then open a pull request that touches SQL:
name: Lexega
on: [pull_request]
jobs:
lexega:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Lexega
run: |
curl -sSL -O https://github.com/Lexega/lexega/releases/download/v3.0.0/lexega-sql-linux-x64
curl -sSL https://github.com/Lexega/lexega/releases/download/v3.0.0/CHECKSUMS.sha256 | grep ' lexega-sql-linux-x64$' | sha256sum -c -
sudo install -m 755 lexega-sql-linux-x64 /usr/local/bin/lexega-sql
- name: SQL review
env:
LEXEGA_LICENSE_KEY: ${{ secrets.LEXEGA_LICENSE_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
lexega-sql ci --dialect snowflake --policy .lexega/policy.yml --env prod --decision-out .lexega/decisions/${{ github.run_id }}/ --pr-commentUse the dialect you gave init; lexega-sql init --with-ci writes a workflow with it. On a pull request, ci reviews the changed SQL against the pull request's base and posts its findings as a comment on the pull request. Later runs update the same comment. When you tighten the policy to block, a blocked change exits with code 2 and fails the check.
GitLab, Azure DevOps and Bitbucket use the same command: CI/CD Integration.
.lexega/reports/: the baseline init records, and the reports a run writes with --report-out, as JSON, YAML or SARIF for code scanning..lexega/decisions/: one decision record per file in each policy run, hashed over the SQL, the policy and the result.lexega-sql dashboard: a local web page over both.CI runners are ephemeral. To keep artifacts from CI runs, write them to cloud storage: Cloud Storage Pipelines.
A Team license covers one team of up to 25 people who commit SQL, for a year, bought by card. When a trial ends the program keeps running at the Free tier.