SQL Review API

EndpointPOST /v1/sql/check
Requesthttps://api.bytebase.com/#model/checkrequest
Responsehttps://api.bytebase.com/#model/checkresponse

The SQL Review API provides SQL checks based on your schema review policy.

Before you start, you should configure the SQL Review Policy.

curl -X POST http://bytebase.example.com/v1/sql/check \
     -H 'Authorization: Bearer '${bytebase_token} \
     -d '{
           "statement": "ALTER TABLE \"user\" ADD \"address\" integer; ALTER TABLE \"user\" DROP COLUMN \"age\";",
           "name": "instances/prod-instance/databases/example"
         }'
{
  "advices": [
    {
      "status": "ERROR",
      "code": 105,
      "title": "schema.backward-compatibility",
      "content": "\"ALTER TABLE \"user\" DROP COLUMN \"age\";\" may cause incompatibility with the existing data and code",
      "line": 1,
      "column": 0,
      "detail": ""
    },
    {
      "status": "WARNING",
      "code": 402,
      "title": "column.no-null",
      "content": "Column \"address\" in \"public\".\"user\" cannot have NULL value",
      "line": 1,
      "column": 0,
      "detail": ""
    }
  ]
}
Edit this page on GitHub

Subscribe toΒ Newsletter

By subscribing, you agree with Bytebase's Terms of Service and Privacy Policy.