There are many awesome REST-wrappers for your Databases (e.g. PostgREST, pREST, sandman2 and many others), but how about REST-wrapper for your own SQL-queries?
The sql-boot tool is a REST-like wrapper for your own SQL-queries.
No ETLs, no generated SQL, no "automagic" - sql-boot simply transform your own SQL-query to Web resources.
sql-boot recursively finds every *.sql files in your folders and start REST-like service and runs scripts against live databases in response to http requests.
Save you SQL-query to big_cities.sql:
selecta.airport_codeas code
, a.airport_name
, a.city
, a.coordinates
, a.timezonefrombookings.airports a
wherea.cityin (selectaa.cityfrombookings.airports aa
group byaa.cityhavingcount(*) >1)
order bya.city
, a.airport_codeNow sql-boot is ready to receive http requests (without restarting and other actions).
Execute query on "master_db" database:
master_db/big_cities.sqlExecute query against all registered databases:
.*/big_cities.sqlExecute query against all registered databases with specified columns:
.*/big_cities.sql?select=code,endpointExecute query with ordering:
master_db/big_cities.sql?select=code&orderby=code-descExecute query with pagination:
master_db/big_cities.sql?select=code&orderby=code-desc&page=1,3sql-boot uses the OpenAPI standard to generate up-to-date documentation for APIs based your SQL-queries metadata. You can use a tool like Swagger-UI or Swagger-Editor to render interactive documentation (for demo requests) or generate client API against the live API server.
It is pronounced "sequelboot" - https://translate.google.com/?source=osdd#en/en/sequelboot
docker run -t -p 8007:8007 mgramin/sql-boot
git clone https://github.com/mgramin/sql-boot
cd sql-boot
mvn package