When modifying data in the database, it’s crucial to ensure that the changes are both safe and accurate. Bytebase offers a feature called SQL Review, which allows you to evaluate your SQL changes before they are applied to the database. SQL Review can be invoked from the Bytebase GUI, CI or API.This is one of the tutorial series of SQL Review:
This tutorial will walk you through using SQL Review in Bytebase with Bytebase API to improve your database schema change process. The Community Plan is sufficient for completing this tutorial.
Make sure you have completed the previous tutorial SQL Review with Bytebase GUI.If you want to test the SQL Review API locally, you may need to configure ngrok.ngrok is a reverse proxy tunnel that provides a public network address to access Bytebase. We use ngrok here for demonstration purposes.
Run Bytebase in Docker with the following command:
Once Bytebase is running in Docker, you can access it at localhost:8080.
Log in to the ngrok Dashboard and complete the Getting Started steps to install and configure ngrok. To use a consistent domain, navigate to Universal Gateway > Endpoints to find your assigned domain: <<YOURS>>.ngrok-free.app.
Start ngrok with your domain by running:
Copy
Ask AI
ngrok http --url=<<YOURS>>.ngrok-free.app 8080
You should see output similar to this:
You can now access Bytebase at https://<<YOURS>>.ngrok-free.app.
(Optional) To configure SSO (Entra/SCIM), log in to Bytebase, click Settings > General in the left sidebar. Scroll to the Network section, set https://<<YOURS>>.ngrok-free.app as the External URL and click Confirm and update.
Now you have learned how to trigger SQL Review in Bytebase API. You may also refer to the SQL Review document for more details. Next, let’s learn how to codify SQL Review policies with API