- SQL Review with Bytebase GUI (this one)
- SQL Review with CI (integrated with Database GitOps workflow):Add commentMore actions
- SQL Review with Bytebase API
- Codify SQL Review Policies with Bytebase API
Prerequisites
Make sure you have Docker installed, and if you don’t have important existing Bytebase data locally, you can start over from scratch byrm -rf ~/.bytebase/data.
Start Bytebase with sample data
-
Ensure Docker is running, then start the Bytebase container:
-
Open Bytebase in localhost:8080, fill in the fields and click Create admin account. You’ll be redirected to Workspace.
-
During workspace setup, choose the built-in sample data.
Configure SQL Review Policies
- Navigate to CI/CD > SQL Review in the left menu. Click Create to create a new SQL review policy.
-
Choose
Sample Template, which has 19 enabled rules, and click Next, then Create. Attach the SQL review policy to EnvironmentProdand click Confirm. -
You’ll see the SQL review policy is created. Note that the
NOT NULLrule is set to P1.
Trigger SQL Review
-
Go to
Sample Project, navigate to CI/CD > Plans and click + New Plan. -
Select
hr_proddatabase as the target since the default SQL Review policy is attached to theProdenvironment. Click Confirm to proceed. You can use the Schema Editor to visually design the schema, here we’ll intentionally uncheck Not Null fornicknamecolumn. -
SQL Review runs automatically on the plan, and Checks reports the violation of the
NOT NULLrule as P1. Click P1 to see the finding.

-
You may resolve this by editing the SQL to add
NOT NULLconstraints. Click Save to update the plan. The SQL Review checks run again and now pass.

