How to setup a preview client with Apache Superset¶
In the previous tutorial, we talked about how to index the table metadata
for a postgres database. In this tutorial, we will walk through how to configure data preview for this
using Apache Superset.
Amundsen provides an integration between Amundsen and BI Viz tool for data preview. It is not necessary to use Apache Superset as long as the BI Viz tool provides endpoint to do querying and get the results back from the BI tool. Apache Superset is an open-source business intelligence tool that can be used for data exploration and it is what we leverage internally at Lyft to support the feature.
- Please setup Apache Superset following its official installation
# Install superset pip install apache-superset # Initialize the database superset db upgrade # Create an admin user (you will be prompted to set a username, first and last name before setting a password) $ export FLASK_APP=superset superset fab create-admin # Load some data to play with superset load_examples # Create default roles and permissions superset init # To start a development web server on port 8088, use -p to bind to another port superset run -p 8088 --with-threads --reload --debugger
Once setup properly, you could view the superset UI as following:
We need to add the postgres database to superset as the following:
We could verify the content of the
filmstable using superset’s sqlab feature:
Next, We need to build a preview client following this guide and the example client code. There are a couple of things to keep in mind:
- We could start with an unauthenticated Superset(example superset config), but in production, we will need to send the impersonate info to Superset to properly verify whether the given user could view the data.
- When we build the client, we could need to configure the database id instead of the database name when send the request to superset.
Once we configure the preview client, put it in the frontend service entry point (example) and restart the frontend.
We could now view the preview data for the
filmstable in Amundsen. From the above figure, the preview button on the table page is clickable. Once it clicked, you could see the actual data queried from Apache Superset: