Simply Superb:

Quick Guide to start with on OS X from Airbnb

This article is about installing and configuring the super cool and admirable D3 charts rendered out of the box from your database directly without a need of any special APIs that are necessary to build. Its called SuperSet and from Airbnb.

There are two Sections in this article. One explains the Docker approach of installing and another is straight installation using python.

Below are the common action items needed to be done for both the sections

😰 When using Docker, Make sure the below settings are in place:

✳ →Get the latest code:

git clone https://github.com/apache/incubator-superset/

✳ →Move to incubator-superset/contrib/docker and run the command

docker-compose up

✳ → If you find the below error:

ERROR: Get https://registry-1.docker.io/v2/: Proxy Authentication Required

✳ → Then its the time to set your proxy. Choose Manual proxy configuration & enter your organizations proxy settings. Usually it should be http://USER:PASSWORD@PROXY.ABC.COM:PORT/

Running the below list commands will bring the superset up and running:

$ docker-compose up -d
$ docker-compose exec superset bash
$ bash docker-init.sh

Note that, if you can’t download the dependencies from your docker image, your firewalls or proxy settings are blocking them.

🆒 Installing using python:

🛑 →You must need python3 and pip3 installed on your machine. ← 🛑

  • Install Brew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Edit your bash_profile.
vi ~/.bash_profile
  • Point the older versions of python to new. Add the below lines into your bash_profile
alias pip='pip3'
alias python='python3'
  • Lets make sure python setuptools and pip is up to date which lets the python know about its module definitions.
$ pip install --upgrade setuptools pip
  • Take a look at the current module definitions for your comparison.
$ pip freeze > req.txt
$ cat req.txt
  • If you want to start fresh, uninstall the existing libs to avoid mismatches.
pip uninstall -r req.txt -y
  • Install the latest version of Superset, If you are behind proxy: turn on your proxy as listed in the hardest section of installation.
$ pip install superset==0.29.0rc7
  • Above command will result the below collected python packages installed.
Installing collected packages: sqlalchemy, geographiclib, geopy, click, MarkupSafe, Jinja2, itsdangerous, Werkzeug, flask, six, python-dateutil, colorama, WTForms, flask-wtf, defusedxml, python3-openid, Flask-OpenID, Flask-SQLAlchemy, Flask-Login, pytz, babel, Flask-Babel, flask-appbuilder, markdown, pyyaml, humanize, flask-compress, unicodecsv, flask-caching, thrift, sasl, thrift-sasl, polyline, numpy, pandas, pathlib2, gunicorn, sqlalchemy-utils, simplejson, python-editor, Mako, alembic, flask-migrate, future, parsedatetime, jmespath, docutils, botocore, unidecode, contextlib2, python-geohash, webencodings, bleach, idna, chardet, urllib3, certifi, requests, jsonschema, et-xmlfile, jdcal, openpyxl, jsonlines, linear-tsv, xlrd, ijson, cchardet, tabulator, isodate, rfc3986, tableschema, pydruid, sqlparse, pyhive, billiard, vine, amqp, kombu, celery, asn1crypto, pycparser, cffi, cryptography, s3transfer, boto3, tornado, flower, superset
Successfully installed Flask-Babel-0.12.2 Flask-Login-0.4.1 Flask-OpenID-1.2.5 Flask-SQLAlchemy-2.3.2 Jinja2-2.10 Mako-1.0.7 MarkupSafe-1.1.0 WTForms-2.2.1 Werkzeug-0.14.1 alembic-1.0.5 amqp-2.3.2 asn1crypto-0.24.0 babel-2.6.0 billiard-3.5.0.5 bleach-3.1.0 boto3-1.9.75 botocore-1.7.48 cchardet-2.1.4 celery-4.2.1 certifi-2018.11.29 cffi-1.11.5 chardet-3.0.4 click-6.7 colorama-0.4.1 contextlib2-0.5.5 cryptography-2.4.2 defusedxml-0.5.0 docutils-0.14 et-xmlfile-1.0.1 flask-1.0.2 flask-appbuilder-1.12.2 flask-caching-1.4.0 flask-compress-1.4.0 flask-migrate-2.3.1 flask-wtf-0.14.2 flower-0.9.2 future-0.17.1 geographiclib-1.49 geopy-1.18.1 gunicorn-19.9.0 humanize-0.5.1 idna-2.8 ijson-2.3 isodate-0.6.0 itsdangerous-1.1.0 jdcal-1.4 jmespath-0.9.3 jsonlines-1.2.0 jsonschema-2.6.0 kombu-4.2.2.post1 linear-tsv-1.1.0 markdown-3.0.1 numpy-1.15.4 openpyxl-2.4.11 pandas-0.23.4 parsedatetime-2.4 pathlib2-2.3.3 polyline-1.3.2 pycparser-2.19 pydruid-0.5.0 pyhive-0.6.1 python-dateutil-2.7.5 python-editor-1.0.3 python-geohash-0.8.5 python3-openid-3.1.0 pytz-2018.9 pyyaml-3.13 requests-2.21.0 rfc3986-1.2.0 s3transfer-0.1.13 sasl-0.2.1 simplejson-3.16.0 six-1.12.0 sqlalchemy-1.2.15 sqlalchemy-utils-0.33.10 sqlparse-0.2.4 superset-0.29.0rc7 tableschema-1.3.0 tabulator-1.19.0 thrift-0.11.0 thrift-sasl-0.3.0 tornado-5.1.1 unicodecsv-0.14.1 unidecode-1.0.23 urllib3-1.24.1 vine-1.2.0 webencodings-0.5.1 xlrd-1.2.0

You may noticed the UI libraries as well, like Babel, Webpack are installed.

  • Create a user: Remember your username and password. We will use these to login into the application later.
$ fabmanager create-admin --app supersetUsername [admin]: gopi
User first name [admin]: gopi
User last name [user]: gopi
Email [admin@fab.org]: gopi@allibilli.com
Password: gopi
Repeat for confirmation: gopi
Recognized Database Authentications.
Admin User gopi created.

If you want to remove all the users, remove the db file from the below directory:

/Users/<USER>/.superset
  • Initialize the database:
$ superset db upgrade
......
INFO [alembic.runtime.migration] Running upgrade 46ba6aaaac97, ec1f88a35cc6 -> c18bd4186f15, empty message
INFO [alembic.runtime.migration] Running upgrade c18bd4186f15 -> 7fcdcde0761c, Reduce position_json size by remove extra space and component id prefix
INFO [alembic.runtime.migration] Running upgrade 7fcdcde0761c -> 0c5070e96b57, add user attributes table
INFO [alembic.runtime.migration] Running upgrade 0c5070e96b57 -> 1a1d627ebd8e, position_json
INFO [alembic.runtime.migration] Running upgrade 1a1d627ebd8e -> 55e910a74826, add_metadata_column_to_annotation_model.py
  • Load the example dataset:
$ superset load_examples......
Creating the dashboard
Loading DECK.gl demo
Loading deck.gl dashboard
Creating Scatterplot slice
Creating Screen Grid slice
Creating Hex slice
Creating Grid slice
Creating Polygon slice
Creating Arc slice
Creating Path slice
Creating a dashboard
  • Create default roles and permissions
$ superset init2019-01-09 15:05:44,825:INFO:root:Creating database reference
2019-01-09 15:05:44,832:INFO:root:Syncing role definition
2019-01-09 15:05:44,863:INFO:root:Syncing Admin perms
2019-01-09 15:05:44,927:INFO:root:Syncing Alpha perms
2019-01-09 15:05:45,144:INFO:root:Syncing Gamma perms
2019-01-09 15:05:45,361:INFO:root:Syncing granter perms
2019-01-09 15:05:45,592:INFO:root:Syncing sql_lab perms
2019-01-09 15:05:45,804:INFO:root:Fetching a set of all perms to lookup which ones are missing
2019-01-09 15:05:45,854:INFO:root:Creating missing datasource permissions.
2019-01-09 15:05:45,860:INFO:root:Creating missing database permissions.
2019-01-09 15:05:45,872:INFO:root:Creating missing metrics permissions
2019-01-09 15:05:45,888:INFO:root:Cleaning faulty perms
  • Start the Superset using Gunicorn. Make sure port 8125 is not in use by any other application at first or use your own port as listed in the below command.
$ gunicorn -b 0.0.0.0:8125 superset:app
Enter the credentials used while create the user in one of above steps

😲 Awesome: You can now see a dashboard as listed below.

Click on one of the example “Worldbank’s Data” to see its data visualization.

D3 Charts.

Customizing the datasources and generating the visualizations directly from your databases are pretty easy and stay tuned for the upcoming article on this.

Find the publication here: https://medium.com/thinkspecial

Gopi Krishna Kancharla- Founder of http://allibilli.com

--

--