To run SQL like query for tables, streams etc. we can use the following API:

Method : GET

URI : /db/<dbname>/table


    "sql":"select * from ...",

BangDB returns around 4MB of data in one shot (this is configurable, but still a limited data in one call), which means if there are more data in the table for the same query then I need to call again. But in next call I would like to start from right where it stopped. This becomes complicated when the query contains filter clauses for secondary or reverse indexes.

BangDB abstracts all these details and helps users with just few key/value pairs that it returns along with response. And in subsequent call, we just need to copy paste those key/value pairs along with the "sql" query and call the API again to get the next set of data. We can keep doing this until data is exhausted in the db or we don't wish to call again. Let's see all the attributes here in the json body.

"sql" : put your sql query here

If in response we see “more_data_to_come” as 1 , then it means we have more data in the table for the query and we need to call it again. This time we will copy whatever other attribute is there in the request json doc as they are (no need to copy "more_data_to_come") along with the original sql query


curl -H "Content-Type: application/json" -d '{"sql": "select * from my_table_test"}' -X POST


         "v":"{\"name\":\"sachin sinha\", \"org\":\"BangDB\", \"likes\":[\"music\",\"cricket\",\"linux\",\"coding\"],\"_pk\":\"user1\",\"_v\":1}"
         "v":"{\"name\":\"Andy B\", \"org\":\"BangDB\", \"likes\":[\"books\",\"mountains\",\"system designs\"],\"_pk\":\"user2\",\"_v\":1}"

As you see here, the response has variable "more_data_to_come" which is set as 0, which means we have retrieved all the data for the query and no need to call the API again.

Table APIs : All table APIs start with /db/<dbname>/<tablename>