Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I embed Superset Apache into Flask web app?

I have a flask web application with many pages where users can insert some data stored in mysql using sqlalchemy. I would create another page with an interactive dashboard. I googled and I found superset that it seems perfect for my app. It's possible embed apache superset (or similar) into my web app? There are some tutorial?

like image 373
Alessio Avatar asked Apr 05 '19 20:04

Alessio


People also ask

What is superset_config Py in flask?

Since superset_config.py acts as a Flask configuration module, it can be used to alter the settings Flask itself, as well as Flask extensions like flask-wtf, flask-caching, flask-migrate , and flask-appbuilder. Flask App Builder, the web framework used by Superset, offers many configuration settings.

How to embed Apache superset in any web application using iframe?

It is possible to embed Apache Superset in any web application using iframe. Copy the URL of the dashboard that you want to embed and add ?standalone=true at the end. This URL can be used in the iframe to render the application. In the above mentioned method you will be seeing login page inside the iframe when you access the dashboard.

What configuration settings are available for flask app builder?

Flask App Builder, the web framework used by Superset, offers many configuration settings. Please consult the Flask App Builder Documentation for more information on how to configure it. SQLALCHEMY_DATABASE_URI: by default it is stored at ~/.superset/superset.db SECRET_KEY: to a long random string

Can I use flask to host an API?

In the production environment, you can not use Flask to host your API and you definitely need a production web server like Apache or Gunicorn. Flask is good for development purposes but when you move to production you need to host it on the Web server. Here is an example of Architecture where it can be helpful. Step 1.


1 Answers

It is possible to embed Apache Superset in any web application using iframe. Copy the URL of the dashboard that you want to embed and add ?standalone=true at the end. This URL can be used in the iframe to render the application.

Problem with the solution:

In the above mentioned method you will be seeing login page inside the iframe when you access the dashboard. You will have to login to the web application and then login to Superset.

Possible solutions

  1. You can make the dashboard public as mentioned in the doc: https://superset.incubator.apache.org/security.html?highlight=public#public
  2. Implement a custom authenticator as mentioned in the post: https://medium.com/@sairamkrish/apache-superset-custom-authentication-and-integrate-with-other-micro-services-8217956273c1

I would recommend the second approach as it would give protection to your data.

like image 192
Nikhil Baby Avatar answered Oct 21 '22 00:10

Nikhil Baby