Analytics & Reporting

♾️SUPERSET Basics

What is Apache Superset?

Apache Superset is a modern, enterprise-ready business intelligence web application. It is fast, lightweight, intuitive, and loaded with options that make it easy for users of all skill sets to explore and visualize their data, from simple pie charts to highly detailed deck.gl geospatial charts.

Why use Apache Superset?

Apache Superset Open Source BI: almost the alternative to Tableau 

by  Susana Santos 

2018-09-17

In a recent blog posted on Jan 19. Dropbox explained why they selected Superset. This matrix from the same blog explains it in a nutshell.

The entire blog is accessible over here.

Installing Superset BI on Mac

There are more than 1 way of installing Superset on Mac. I would recommend not to use the PIP method as Mac comes with bundled Python and following the steps using PIP might corrupt your OS. macOS BigSur version does not allow PIP and you need to use PIP3. I wasn’t completely successful using PIP3 but if you can get any further keep me honest.

Installing Superset Locally Using Docker Compose

I followed the steps mentioned in the superset website. And faced some challenges. Which I overcame after getting expert guidance from Superset. You can skip the following steps and go straight to “Actual working steps”

1. Install a Docker Engine and Docker Compose

Mac OSX

Install Docker for Mac, which includes the Docker engine and a recent version of docker-compose out of the box.

2. Clone Superset’s Github repository

Clone Superset’s repo in your terminal with the following command:

git clone https://github.com/apache/superset.git
Cloning into 'superset'...
remote: Enumerating objects: 36, done.
remote: Counting objects: 100% (36/36), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 89848 (delta 4), reused 11 (delta 0), pack-reused 89812
Receiving objects: 100% (89848/89848), 238.49 MiB | 15.16 MiB/s, done.
Resolving deltas: 100% (65775/65775), done.
Updating files: 100% (2585/2585), done.

Once that command completes successfully, you should see a new superset folder in your current directory.

3. Launch Superset Through Docker Compose

Navigate to the folder you created in step 1:

cd superset

We recommend that you check out and run the code from the last tagged release:

git checkout latest

Note: switching to 'latest'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at c9a755f25 update changelog for rc2 cherries
kinshukdutta@Kinshuks-MacBook-Pro-15 superset % 

Then, run the following command:


docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: kinshukdutta
Password: 
Login Succeeded
kinshukdutta@Kinshuks-MacBook-Pro-15 superset % docker-compose up  
WARNING: The CYPRESS_CONFIG variable is not set. Defaulting to a blank string.
Creating network "superset_default" with the default driver
Creating volume "superset_superset_home" with default driver
Creating volume "superset_db_home" with default driver
Creating volume "superset_redis" with default driver
Pulling redis (redis:3.2)...
3.2: Pulling from library/redis
f17d81b4b692: Pull complete
b32474098757: Pull complete
8980cabe8bc2: Pull complete
58af19693e78: Pull complete
a977782cf22d: Pull complete
9c1e268980b7: Pull complete
Digest: sha256:7b0a40301bc1567205e6461c5bf94c38e1e1ad0169709e49132cafc47f6b51f3
Status: Downloaded newer image for redis:3.2
Pulling db (postgres:10)...
10: Pulling from library/postgres
cae7303ade7f: Pull complete
74b1b2de3667: Pull complete
2a8214680dbf: Pull complete
2d96c85c9c8e: Pull complete
ea61da79a978: Pull complete
ad4d0ef2cddb: Pull complete
6a2c02e60b45: Pull complete
9a9993af0b23: Pull complete
15d15976abba: Pull complete
6a2d243e3a87: Pull complete
e67bd711bcc5: Pull complete
79bfed2e4bed: Pull complete
e733f445b349: Pull complete
657e609f1643: Pull complete
Digest: sha256:e957014667e27c2fad2f48c818f2ba77443d60481e5d28b14e11d0b461c104aa
Status: Downloaded newer image for postgres:10
Pulling superset (apache/superset:latest-dev)...
latest-dev: Pulling from apache/superset
0ecb575e629c: Pull complete
7467d1831b69: Pull complete
feab2c490a3c: Pull complete
f15a0f46f8c3: Pull complete
937782447ff6: Pull complete
e78b7aaaab2c: Pull complete
5d8a97050e38: Pull complete
d36c23e9d08d: Pull complete
d39496292349: Pull complete
1b8dff8ed49d: Pull complete
9b0f7e987754: Pull complete
a0488fe8a47f: Pull complete
105918b1aac1: Pull complete
e8284c65a632: Pull complete
eeafbcceed61: Pull complete
b369546def70: Pull complete
fd68c23b45a1: Pull complete
621e7d3daf4f: Pull complete
b7b953158299: Pull complete
646f0301b300: Pull complete
Digest: sha256:55f81779618d6b4ebb705fd4f27caf6a52e4360d6067103d58039ac1d96815f6
Status: Downloaded newer image for apache/superset:latest-dev
Pulling superset-node (node:12)...
12: Pulling from library/node
1e987daa2432: Pull complete
a0edb687a3da: Pull complete
6891892cc2ec: Pull complete
684eb726ddc5: Pull complete
b0af097f0da6: Pull complete
154aee36a7da: Pull complete
addefe6de949: Pull complete
b1a2e60de810: Pull complete
4ff735fbb52d: Pull complete
Digest: sha256:7f961434ce9e96be7bf2455bbf362152787c529bb9cf86a15ab1499ea89bfa8c
Status: Downloaded newer image for node:12
Creating superset_cache ... 
Creating superset_db    ... error
Creating superset_cache ... done
ERROR: for superset_db  Cannot start service db: Ports are not available: listen tcp 127.0.0.1:5432: bind: address already in use

ERROR: for db  Cannot start service db: Ports are not available: listen tcp 127.0.0.1:5432: bind: address already in use
ERROR: Encountered errors while bringing up the project.

I was getting 5432 port conflict error. In Mac OSX, you can use sudo lsof -i :5432 | grep LISTEN to find out what program is listening on port 5432 :

In terminal

sudo lsof -i :5432

Password:
COMMAND  PID     USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
postgres  92 postgres    7u  IPv6 0x451da3ea350677eb      0t0  TCP *:postgresql (LISTEN)
postgres  92 postgres    8u  IPv4 0x451da3ea396490b3      0t0  TCP *:postgresql (LISTEN)

This is typical if you have Postgres installed and running on your local. We can further drill in to verify that it is in fact postgres

ps -ef 92
  UID   PID  PPID   C STIME   TTY           TIME CMD
  502    92     1   0 Thu09AM ??         0:27.61 /Library/PostgreSQL/13/bin/postmaster -D/Library/PostgreSQL/13/data

You can either gracefully stop it or kill that process if not needed.

sudo kill -SIGTERM 92

restart the installation.

You should see a wall of logging output from the containers being launched on your machine. Once this output slows, you should have a running instance of Superset on your local machine!

kinshukdutta@Kinshuks-MacBook-Pro-15 superset % docker-compose up               
WARNING: The CYPRESS_CONFIG variable is not set. Defaulting to a blank string.
Starting superset_db ... 
Starting superset_db ... done
Creating superset_worker       ... done
Creating superset_node         ... done
Creating superset_app          ... done
Creating superset_tests_worker ... done
Creating superset_init         ... done
superset_init            | DEBUG:superset.models.core:Database.get_sqla_engine(). Masked URL: postgresql://superset:XXXXXXXXXX@db:5432/superset

4. Log in to Superset

Your local Superset instance also includes a Postgres server to store your data and is already pre-loaded with some example datasets that ship with Superset. You can access Superset now via your web browser by visiting http://localhost:8088. Note that many browsers now default to https – if yours is one of them, please make sure it uses http.

Log in with the default username and password:

username: admin
password: admin

Expected results

I expect after these steps if I open http://localhost:8088, I see Superset UI. But the icon was missing. I provided the credentials and it should have shown the UI.

Actual results

I see a blank page at http://localhost:8088


Fixed – Proper Installation Steps

Looks like a known issue. Followed the steps mentioned here.

Bumped the docker memory to 16 GB and restarted.

Thanks to Srini Kadamati and Bill Greer I was able to solve the issue I had. Suggested approach was:

Delete the superset folder and did a clean clone of master. Then make sure of the following:

  • Are you on latest superset version / master?
  • Are you sure you’re in the superset-frontend folder within superset?
  • Make sure you’re on latest npm: npm install -g npm
  • Then do npm install you shouldn’t have to sudo but you can if you want
  • Then do sudo npm run build
rm -rf superset
git clone [email protected]:KinshukON/superset.git
Cloning into 'superset'...
remote: Enumerating objects: 89821, done.
remote: Total 89821 (delta 0), reused 0 (delta 0), pack-reused 89821
Receiving objects: 100% (89821/89821), 238.46 MiB | 9.86 MiB/s, done.
Resolving deltas: 100% (65775/65775), done.
Updating files: 100% (2584/2584), done.

navigate to the superset-frontend folder within the downloaded superset project. And execute a npm install which will download the package and it’s dependencies

cd superset 
kinshukdutta@Kinshuks-MacBook-Pro-15 superset % cd superset-frontend

kinshukdutta@Kinshuks-MacBook-Pro-15 superset-frontend % sudo npm install
Password:
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '^14.15.5', npm: '^7.5.4' },
npm WARN EBADENGINE   current: { node: 'v15.10.0', npm: '7.5.6' }
npm WARN EBADENGINE }
....
Run `npm audit` for details.
kinshukdutta@Kinshuks-MacBook-Pro-15 superset-frontend % npm audit fix --force

Once the download is complete. Execute the build process.


kinshukdutta@Kinshuks-MacBook-Pro-15 superset-frontend % sudo npm run build


> [email protected] build
> cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=production BABEL_ENV=production webpack --mode=production --colors

clean-webpack-plugin: dangerouslyAllowCleanPatternsOutsideProject requires dry: false to be explicitly set. Enabling dry mode
Starting type checking service...
Using 1 worker with 4096MB memory limit
67% building 739/774 modules 35 active /Users/kinshukdutta/superset/superset-frontend/node_modules/lodash/_getFuncName.jsBrowserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
92% chunk asset optimization OptimizeCssAssetsWebpackPluginBrowserslist: caniuse-lite is outdated. Please run next command `npm update`
   6920 modules

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  c632cd2773714a261fee.chunk.js (1.64 MiB)
  730e2734b949c4103307.chunk.js (788 KiB)
  88e2a94f9ae57b5609a3.chunk.js (312 KiB)
  ebbc23f34bcd06b09513.chunk.js (453 KiB)
  3b0fe4f52b01e050f9f5.chunk.js (531 KiB)
  5d82d1b53c008164c101.chunk.js (946 KiB)
  4bdf800563516f22c46d.chunk.js (1 MiB)
  48560899a6644df4ed83.chunk.js (360 KiB)
  831b62337dcda011a246.chunk.js (253 KiB)
  addSlice.c9d504cf547674a38f6c.entry.js (975 KiB)
  crudViews.e4b7ef47b6fcd1381793.entry.js (1.37 MiB)
  dashboard.cc6b6862de3e8801465a.entry.js (1.97 MiB)
  explore.fb83ca2dc3e4b3256c4d.entry.js (1.63 MiB)
  menu.62b8c39d2f098c97f613.entry.js (473 KiB)
  profile.7dbb4a4e992ade71d3e5.entry.js (627 KiB)
  sqllab.1c5c3da6876c3af95f1b.entry.js (1.56 MiB)
  theme.09fe547c2d83d9be0faa.entry.css (2.69 MiB)
  2a557290aafac7c4e50a.chunk.js (448 KiB)
  65129be77c065e3f5d08.chunk.js (256 KiB)
  images/bubble.png (459 KiB)
  images/cloud.png (702 KiB)
  images/dash.png (328 KiB)
  images/superset_screenshot.png (552 KiB)
  images/screenshots/bank_dash.jpg (371 KiB)
  images/screenshots/deckgl_dash.png (482 KiB)
  images/screenshots/explore.jpg (435 KiB)
  images/screenshots/explore.png (435 KiB)
  images/screenshots/explore_visualizations.jpg (474 KiB)
  images/screenshots/gallery.jpg (275 KiB)
  images/screenshots/gallery.png (275 KiB)
  images/screenshots/geospatial_dash.jpg (482 KiB)
  images/screenshots/slack_dash.jpg (371 KiB)
  images/screenshots/sql_lab.jpg (406 KiB)
  images/screenshots/sqllab.jpg (406 KiB)
  images/screenshots/visualizations.png (474 KiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  theme (2.69 MiB)
      theme.09fe547c2d83d9be0faa.entry.css
      theme.09fe547c2d83d9be0faa.entry.js
  preamble (1.71 MiB)
      c632cd2773714a261fee.chunk.js
      a42ca540ff6fe4919a90.chunk.js
      preamble.bb79c4e06096402b98f7.entry.js
  addSlice (3.2 MiB)
      c632cd2773714a261fee.chunk.js
      3b0fe4f52b01e050f9f5.chunk.js
      6798264d136eb8487814.chunk.js
      addSlice.c9d504cf547674a38f6c.entry.css
      addSlice.c9d504cf547674a38f6c.entry.js
  explore (3.89 MiB)
      c632cd2773714a261fee.chunk.js
      3b0fe4f52b01e050f9f5.chunk.js
      6798264d136eb8487814.chunk.js
      explore.fb83ca2dc3e4b3256c4d.entry.css
      explore.fb83ca2dc3e4b3256c4d.entry.js
  dashboard (4.26 MiB)
      c632cd2773714a261fee.chunk.js
      3b0fe4f52b01e050f9f5.chunk.js
      6798264d136eb8487814.chunk.js
      dashboard.cc6b6862de3e8801465a.entry.css
      dashboard.cc6b6862de3e8801465a.entry.js
  sqllab (3.28 MiB)
      c632cd2773714a261fee.chunk.js
      a42ca540ff6fe4919a90.chunk.js
      sqllab.1c5c3da6876c3af95f1b.entry.css
      sqllab.1c5c3da6876c3af95f1b.entry.js
  crudViews (3.62 MiB)
      c632cd2773714a261fee.chunk.js
      3b0fe4f52b01e050f9f5.chunk.js
      6798264d136eb8487814.chunk.js
      crudViews.e4b7ef47b6fcd1381793.entry.css
      crudViews.e4b7ef47b6fcd1381793.entry.js
  menu (2.17 MiB)
      c632cd2773714a261fee.chunk.js
      a42ca540ff6fe4919a90.chunk.js
      menu.62b8c39d2f098c97f613.entry.js
  profile (2.32 MiB)
      c632cd2773714a261fee.chunk.js
      a42ca540ff6fe4919a90.chunk.js
      profile.7dbb4a4e992ade71d3e5.entry.css
      profile.7dbb4a4e992ade71d3e5.entry.js
  showSavedQuery (1.82 MiB)
      c632cd2773714a261fee.chunk.js
      showSavedQuery.3b4fe8376bfcac02e567.entry.css
      showSavedQuery.3b4fe8376bfcac02e567.entry.js

After the build is over. Move back to the superset project main folder and run docker-compose up.


kinshukdutta@Kinshuks-MacBook-Pro-15 superset-frontend % cd ..
kinshukdutta@Kinshuks-MacBook-Pro-15 superset % docker-compose up

Now you can access Superset now via your web browser by visiting http://localhost:8088.

Superset console login

By providing the default credentials. admin/admin. You can access the landing page.

Basic Operations

Dashboard

The base installation comes with some sample data on some Postgres table. And it also comes with a sample dashboard. You can click on the dashboard in the landing section and it will take you to the preconfigured dashboard which will give you an idea of what kind of reporting can be achieved by Superset.

US Birth Names Dashboard

One can share the dashboard either via email with a link to access or as an image.