Babelfish Compass REST API
Problem to solve
We want to integrate Babelfish Compass into the StackGres REST API in order to be able to asses compatibility of SQL Server schema with Babelfish for PostgreSQL.
Further details
Babelfish Compass generates from an SQL source file a series HTLMs files with logs of the performed operations, the report and the SQL source file provided.
Proposal
The /stackgres/application
REST API (see #1536 (closed)) will have to return {name: "babelfish-compass", publisher: "com.ongres"}
when env var APPLICATION_BABELFISH_COMPASS
is not set to true
.
A new REST API endpoint /stackgres/application/com.ongres/babelfish-compass
will be created.
The endpoint will be disabled when env var APPLICATION_BABELFISH_COMPASS
is not set to true
.
The endpoint will accept the POST method with a payload consisting of an SQL file. A ConfigMap with the SQL file will be created together with a Job that will generate the report using the SQL file from the ConfigMap. The same ConfigMap will be updated by the Job with the resulting HTML report, the HTML with the source SQL and the HTML with the logs of the operation. The REST API will return the following JSON object with a 200 HTTP code:
report: <string> # HTML with the report
logs: <string> # HTML with the logs
source: <string> # HTML with the source SQL
On error operation the REST API will return the following JSON object with a 500 HTTP code:
type: <string>
title: <string>
detail: <string> # the logs
status: <integer>
fields:
- <string>
The APPLICATION_BABELFISH_COMPASS
will be configurable using the StackGres helm chart parameter application[0].babelfish-compass
Links / references
https://github.com/babelfish-for-postgresql/babelfish_compass