Apache Superset and SQL Alchemy usage with OmnisciDB

Hi to all,

This post is a quick guide about installing the SQL Alchemy dialect developed by the community to use the HeavyAI database as a Datasource of Apache Superset Tool.

All you need to install in your python environment (venv or Conda) is the dialect package that, starting with the 6.0 version, is called sqlalchemy-heavyai.

so install it with pip (the conda version will take some other days) in the usual way

pip install sqlalchemy-heavyai

The sqlalchemy dialect and the python driver will install in your environment.

(base) mapd@zion-tr:~$ pip install sqlalchemy-heavyai 
Collecting sqlalchemy-heavyai
  Using cached sqlalchemy_heavyai-1.0-py3-none-any.whl (12 kB)
[CUT]
...
Collecting pyheavydb>=6.0.0
  Using cached pyheavydb-6.0.0.post2-py3-none-any.whl (97 kB)
[CUT]
...
Installing collected packages: pyheavydb, sqlalchemy-heavyai
Successfully installed pyheavydb-6.0.0.post2 sqlalchemy-heavyai-1.0.

Now you have just to get this file omnisci.txt (2,0 KB) , rename into heabydb.py, then place inside your superset installation under the db_engine_specs folder
e.g.
~/miniconda3/envs/pymapd/lib/python3.7/site-packages/superset/db_engine_specs

Then restart the superset service.

to add a heavyai database, go in the under the tab Sources, select Database
and add a new database with type other and configure the URL to connect following the example

heavydb://admin:your_password@localhost:6274/heavydb

after that, test the connection; you should get a popup in the right corner of the screen
image

Now you can query your database with the sql_lab tool ad create your charts.


for this example, you need a Mapbox key to add to Superset configuration

We tested the Dialect + Drivers against 1.2 and 1.4 versions of Apache Superset.

For suggestions on how to improve the support or to raise issues use this thread or [GitHub](https://github.com/heavyai/sqlalchemy-heavyai)

3 Likes