Connecting Superset: Difference between revisions

From Zymonic
Content added Content deleted
Line 63: Line 63:


sudo zymonic_toolkit.pl Superset connect_superset --system ztsm --username alexm --password ! --hostname md4.zednax.com
sudo zymonic_toolkit.pl Superset connect_superset --system ztsm --username alexm --password ! --hostname md4.zednax.com

==Starting Superset==

Firstly ensure that there is a /var/log/superset and it is accessible by the user that superset will run as.


==Creating a Source==
==Creating a Source==

Revision as of 11:47, 4 January 2021

Connecting Superset

"Apache Superset is a modern data exploration and visualization platform" - Zymonic Systems can be configured such that selected filters can be denormalised (all data cisible to the user in a filter stored in a single table for fast access and filtering) and single sign on to Superset can be achieved with Zymonic's OAuth server capability.

Installation

The installation and connection is designed to be as automated as possible.

The first step is to use the Zymonic Installer Toolkit (or a wrapper e.g. zymobuild) to bring your system up to date and a 'config_build' of each system you wish to connect to Superset.

Next install the superset manifest:

  sudo zymonic_toolkit.pl Installer install --manifests superset

The installer will ask some additional questions related to Superset:

 Superset bin dir - The bin dir of superset (where superset_config.py resides) (currently set to )
 Superset bin dir: /home/superset/.local/bin/
 Superset group - The group that the superset server will run as. (currently set to )
 Superset group: superset
 Superset hostname - The hostname users will use to connect to Superset (currently set to )
 Superset hostname: md5.zednax.com
 Superset ip address - The IP address superset will listen on (currently set to )
 Superset ip address: 0.0.0.0
 Superset log directory - The superset log file - will be rotated daily (currently set to )
 Superset log directory: /var/log/superset/superset.log
 Superset master system - The system of which the superusers are also Admin users of Superset (currently set to )
 Superset master system: ztsm
 Superset port - The port on which superset will listen (currently set to )
 Superset port: 8088
 Superset SQLite file - The path of the Superset SQLite file (usually [sqlite home]/.superset/superset.db (currently set to )
 Superset SQLite file: /home/superset/.superset/superset.db
 Superset SSL cert - The path of the Superset SSL certificate file (currently set to )
 Superset SSL cert: /etc/ssl/wildcard/wildcard.zednax.com.2019.crt
 Superset SSL key - The path of the Superset SSL key file (currently set to )
 Superset SSL key: /etc/ssl/wildcard/wildcard.zednax.com.2019.key
 Superset user - The user that the superset server will run as. (currently set to )
 Superset user: superset

The values above are examples and may or may not be correct for you system.

Next ensure that the the Python and PIP present and correctly installed (Python needs to have been compiled with sqlite flag).

A determination then needs to be made about which user to run Apache Superset as - bear in mind that both the apache process and superset process will need to write to the Superset SQLite database. So far having a superset and an apache user with permissions on the SQLite DB allowing access to both users has been tested.

Once Python (with SQLite) and PIP are installed then run the following command as the selected user:

 zymonic_toolkit.pl Superset install_superset

It is possible that Python module requirements may not be properly installed (e.g. currently, on the 4th Jan 2021, PyJWT needs to be installed at a lower version that is current); if so they will need to be manually resolved and the install command re-run - this can be done a number of times if necessary, but .profile may need the extra lines removing from the end of it as duplicates will be created.

Connecting Superset and Zymonic

Firstly link the ZymonicSuperset.xml file into any systems that you wish to connect to Superset - the connect will fail with a message telling you to do this if you forget.

 sudo ln -s /root/trunk/modules/ZymonicSuperset/xml/ZymonicSuperset.xml /etc/zymonic/ztsm/
 

Then do a config build.

 sudo zymonic_toolkit.pl Superset connect_superset --system ztsm --username alexm --password ! --hostname md4.zednax.com

Finally run the connect_superset command

 sudo zymonic_toolkit.pl Superset connect_superset --system ztsm --username alexm --password ! --hostname md4.zednax.com

Starting Superset

Firstly ensure that there is a /var/log/superset and it is accessible by the user that superset will run as.

Creating a Source

Creating a Chart

Troubleshooting

Logs

SQLite

The SQLite DB can be accessed using

 sqlite3 [path to superset db]

The path will usually be the home dir of the user that superset was installed as, followed by .superset/superset.db.

Useful SQLite specific commands:

 .tables
 .schema [table name] 
 .quit

The key tables that Zymonic uses and updates are:

  • dbs - the list of denormalised DBs that Superset connects to
  • tables - the list of denormalised tables that Superset connects to
  • table_columns - the list of columns in the denormalised tables
  • ab_permission - the list of permissions that Superset can apply to its 'objects'
  • ab_view_menu - the list of 'objects' e.g. tables or DBs that can be viewed by users
  • ab_permission_view - a list of which permissions apply to which viewable objects
  • ab_role - a list of roles (Zymonic roles will be created in here as [system]_[Zymonic role]
  • ab_permission_view_role - a list of which roles have which 'permission view' permissions.