Best Flask open-source libraries and packages

Streamer

Stream PostgreSQL queries using NDJSON
Updated 3 years ago

Streamer

Simple way to stream any single PostgreSQL query using NDJSON.

How to use

There is a single endpoint POST / with two parameters, query and params.

These are some body examples:

{
  "query": "SELECT * FROM table WHERE field = %s",
  "params": ["value"]
}
{
  "query": "SELECT * FROM table WHERE int_field = %(param1)s AND str_field = %(param2)s",
  "params": {
    "param1": 123, 
    "param2": "value2"
  }
}

Running

Run locally:

$ pip install virtualenv
$ virtualenv venv
$ . venv\bin\activate
(venv) $ pip install -r requirements.txt
(venv) $ python app/main.py

Or use docker:

$ docker build -t streamer .
$ docker run --rm -p 80:80 streamer