The app installs a /sql REST API web app which accepts SQL query with POST request on /sql/query endpoint and returns the result in JSON.
zpm:USER>install sql-rest
Create your repository from template.
Clone/git pull the repo into any local directory e.g. like it is shown below (here I show all the examples related to this repository, but I assume you have your own derived from the template):
$ git clone git@github.com:evsharov/sql-rest-api.git
Open the terminal in this directory and run:
$ docker-compose up -d --build
or open the folder in VSCode and do the following:
This template creates /sql REST web-application on IRIS which accepts POST requests with SQL and returns results in JSON
Open http://localhost:52775/swagger-ui/index.html?url=http://localhost:52775/api/mgmnt/v1/USER/spec/sql to test the REST API
You can query any table in IRIS in the namespace.
e.g. you can test with Titanic data, which you have if you start docker. if you installed with ZPM in a clear namespace you can import titanic data as:
USER>zpm "install csvgen" USER>d ##class(community.csvgen).GenerateFromURL("https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv",",","Data.Titanic")