Skip to content

evshvarov/sql-rest-api

Repository files navigation

sql2json-rest-api

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.

Installation with ZPM

zpm:USER>install sql-rest

Installation for development

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 [email protected]: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: rest

How to Work With it

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")

And run query POST request as: Screenshot 2020-12-12 at 23 52 40

and have the result as: Screenshot 2020-12-12 at 23 54 36

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •