Skip to main content
Version: Latest-3.3

Superset Support

Apache Superset is a modern data exploration and visualization platform. It uses SQLAlchemy to query data.

Although Mysql Dialect can be used, it does not support largeint. So we developed StarRocks Dialect.

Environment

Notice: If mysqlclient is not installed, an exception will be thrown:

No module named 'MySQLdb'

Installation

Since dialect does not contribute to SQLAlchemy, it needs to be installed from the source code.

If you install superset with Docker, install sqlalchemy-starrocks with root.

Install from Source Code

pip install .

Uninstall

pip uninstall sqlalchemy-starrocks

Usage

To connect to StarRocks with SQLAlchemy, the following URL pattern can be used:

starrocks://<username>:<password>@<host>:<port>/<database>[?charset=utf8]

Basic Example

Sqlalchemy Example

It is recommended to use python 3.x to connect to the StarRocks database, eg:

from sqlalchemy import create_engine
import pandas as pd
conn = create_engine('starrocks://root:@x.x.x.x:9030/superset_db?charset=utf8')
sql = """select * from xxx"""
df = pd.read_sql(sql, conn)

Superset Example

In superset, use Other database, and set url as:

starrocks://root:@x.x.x.x:9030/superset_db?charset=utf8