Goal
Submit changed SQL from any CI/CD runner, wait for PawSQL analysis, and convert the result into a build decision.Prerequisites
Use PawSQL OpenAPI with a configured workspace, review policy, and identity, referring to the API reference for endpoint definitions.Pipeline pattern
1
Detect SQL changes
Compute the changed SQL files from the version-control diff, ignoring removed files.
2
Submit the review
Call the OpenAPI to create a review job for the workspace and policy, attaching the SQL and optional context.
3
Wait for the result
Poll the job until it reaches a terminal state, respecting the configured timeout.
4
Read the decision
Retrieve the gate decision, finding counts, and report link.
5
Apply the gate
Map the decision to a build result using the status mapping in SQL Quality Gates and Feedback.
6
Handle failure
Apply the configured failure policy on timeout, authentication error, or service unavailability.
Example script
Practical guidance
- Send database dialect and a version identifier with each review.
- Attach the DDL required by the review policy when the workspace cannot provide it.
- Select only new and modified SQL files, not the whole repository.
- Use a per-run identity with the least privilege required.
- Keep the PawSQL token out of logs and exported environment.
- Make the timeout and failure policy explicit in the pipeline.
- Store the report link and job ID in the build artifacts for traceability.