diff --git a/Readme.md b/Readme.md index 5eacb3c..dbb28c7 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,6 @@ # SQL chart -Draw chart any SQL queries +Draw chart for any SQL queries ## What is this? @@ -13,7 +13,17 @@ A simple web application to visualize data from any arbitrary SQL query. * available columns in the data will be shown in UI. visualize the data by dragging columns into required axis. Also choose requied aggregation function for pivot table * Entire state of the graph ( SQL, columns in each axis, aggregation function etc ) is stored in the URL ( in URL hash ) so that we can reload the page without loosing the data. +## How to run this +```bash +git clone https://github.com/harish2704/sql-chart +cd sql-chart +pip2 install -r requirements.txt --user +# Edit config file and set database connection url. For details, refer https://docs.sqlalchemy.org/en/latest/core/engines.html +./run.sh +``` + + ## Thanks * Authors of pivottable ( https://github.com/nicolaskruchten/pivottable ). The UI code is shamelessly copied from one of the examples given in this project. * Simple backed api server ( server.js ) is written in https://falconframework.org/. -* https://plot.ly/javascript/ \ No newline at end of file +* https://plot.ly/javascript/ diff --git a/run.sh b/run.sh index ee83456..c1ce1a1 100755 --- a/run.sh +++ b/run.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash -[ -f ./env.sh ] && . ./env.sh && export DB_CONNECTION +[ -f ./config ] && . ./config && export DB_CONNECTION gunicorn server:api diff --git a/server.py b/server.py index 8516162..d871d05 100644 --- a/server.py +++ b/server.py @@ -6,7 +6,7 @@ import datetime import os db_url = os.environ[ 'DB_CONNECTION' ] if 'DB_CONNECTION' in os.environ else 'postgresql://postgres@localhost/postgres' -eng = sqlalchemy.create_engine(db_url, pool_size=1, pool_recycle=3600) +eng = sqlalchemy.create_engine(db_url, pool_recycle=3600) conn = eng.connect() print "Connected to db"