SQL Review is skipped for statements exceeding 1MB to prevent excessive processing time.
SQL Review automatically validates SQL statements against best practices and catches potential issues before they reach production. This eliminates manual review bottlenecks and ensures consistent code quality across your database changes.

How SQL Review Works

SQL Review operates as an automated gatekeeper in your database change workflow:
  1. Automatic Triggering: Activates whenever database changes are created or modified
  2. Rule Evaluation: Checks SQL statements against your configured review rules
  3. Instant Feedback: Provides immediate validation results with actionable insights
  4. Enforcement Levels: Applies Error, Warning, or Disabled status based on your policy configuration
The review process validates:
  • Compliance with configured SQL Review Rules
  • Database connectivity and compatibility
  • SQL syntax correctness
  • Schema migration tracking
  • Performance implications
  • Security best practices
sql-advisor

Setting Up SQL Review

Tutorial: SQL Review with Bytebase GUI

Step 1: Create a Review Policy

Navigate to SQL Review under Security & Policy in the sidebar. You can create a new policy by:
  1. Starting from a template: Choose a predefined template based on best practices
  2. Building from scratch: Select specific rules for your requirements
bb-sql-review-basic-info

Step 2: Configure Review Rules

Select and configure the SQL Review Rules for each database engine your policy will support. For each rule, set the enforcement level:
  • Error: Violations must be fixed before changes can proceed
  • Warning: Violations are flagged but won’t block execution
  • Disabled: Rule is not enforced
bb-sql-review-configure-rule
Both Warning and Error levels will block automatic rollout if configured.

Step 3: Attach Policy to Resources

Attach your SQL Review Policy to specific environments or projects to activate it: bb-sql-review-attach-resource

Policy Configuration

Tutorial: Codify SQL Review Policies with Bytebase API

Required Permissions

To configure SQL Review Policies, you need one of the following roles:
  • Workspace Admin: Full access to create and manage policies across all environments and projects
  • DBA: Can create and manage policies for database administration purposes

Policy Scope and Application

SQL Review Policies operate at two levels with different scopes and access points:
LevelScopeAccess LocationPriority
ProjectApplies to all databases within a specific projectProject settings pageHigher
EnvironmentApplies to all databases within an environmentEnvironment settings pageLower
You can also manage all policies centrally from SQL Review under the Security & Policy sidebar.
Project-level policies override environment-level policies. Only one policy can be attached per environment or project.

Managing Rules

Add or Remove Rules

Customize your policy by adding or removing rules specific to each database engine: bb-sql-review-add-remove

Adjust Rule Severity

Fine-tune enforcement by adjusting rule levels based on your team’s requirements:
  • Use Error for critical standards that must never be violated
  • Use Warning for best practices that should be reviewed
  • Use Disabled to temporarily or permanently skip specific checks

Policy Management

Disable a Policy

Temporarily disable a policy without deleting it when you need to:
  • Perform emergency fixes
  • Test new rule configurations
  • Accommodate special deployment scenarios

Delete a Policy

Remove policies that are no longer needed:
  1. First disable the policy to ensure it’s not actively in use
  2. Then delete it from the policy list
bb-sql-review-policy