当前位置:网站首页>[data visualization] use Apache superset to visualize Clickhouse data
[data visualization] use Apache superset to visualize Clickhouse data
2022-06-11 20:38:00 【Rookie millet】

List of articles
Apache Superset Is a powerful BI Tools , It provides a way to view and explore data . It's in ClickHouse It's becoming more and more popular among users .
We'll talk about installing Superset Of 2 Methods , And then show how to start from Superset Connect to your first ClickHouse database . The code example is based on Ubuntu 18.04、Superset 1.1.0 and clickhouse-sqlalchemy 0.1.6.
Method 1 :Python A virtual environment
The first way is to install it directly on your host Superset. We will first create a Python A virtual environment . Here are some common commands .
python3 -m venv clickhouse-sqlalchemy
. clickhouse-sqlalchemy/bin/activate
pip install --upgrade pi
Install and start Superset
Install dependency packages
sudo apt-get install build-essential libssl-dev libffi-dev python-dev python-pip libsasl2-dev libldap2-dev
Deal with ClickHouse Of Superset Connected commands . It may need to be adjusted slightly according to your environment .
export FLASK_APP=superset
pip install apache-superset
superset db upgrade
superset fab create-admin
superset load_examples
superset init
install clickhouse-sqlalchemy The driver
pip install clickhouse-sqlalchemy
clickhouse-driver Version must be 0.2.0 Or later .
pip freeze |grep clickhouse
clickhouse-driver==0.2.0
clickhouse-sqlalchemy==0.1.6
start-up Superset And login
It's time to start Superset 了 . Run the following command :
superset run -p 8088 --with-threads --reload --debugger
Browser access localhost:8088
You will see the login screen shown below . Enter your Superset Administrator login and password defined during installation ( for example ,admin/secret).

Method 2: Use Docker Compose function Superset
If you don't want to be obsessed with Python edition 、 Virtual environment and pip. have access to docker.
First installation docker and docker-compose.
After installation, check the version .
$ docker --version
Docker version 19.03.4, build 9013bf583a
$ docker-compose --version
docker-compose version 1.29.1, build c34c88b2
Use docker-compose install superset
git clone https://github.com/apache/superset
cd superset
touch ./docker/requirements-local.txt
echo "clickhouse-driver>=0.2.0" >> ./docker/requirements-local.txt
echo "clickhouse-sqlalchemy>=0.1.6" >> ./docker/requirements-local.txt
docker-compose -f docker-compose-non-dev.yml up
After successful operation Browser access localhost:8088
Default login / The password is admin / admin.
Connect to ClickHouse
No matter which installation method you choose , You can now connect to your first ClickHouse database .
After logging in , You will see a screen , It includes your recent work and the current dashboard . Select the data tab in the upper right corner , Then select the database . A page will appear , It contains your current database connection . Press **+ database ** Button to add a new database .

Enter the following values :
Database name :clickhouse-public
SQLALCHEMY website :clickhouse+native://demo:[email protected] /default?secure=true
Altinity.Cloud It's a public dataset site .

Press the test connection button . Save the link after success .
Connection process
The connection uses SQLAlchemy, It's a way to connect ClickHouse And many other common databases API.

SQLAlchemy The connection uses a dedicated URL Format . To connect to ClickHouse, You need to provide an example similar to the one we showed earlier URL:
clickhouse+native://demo:[email protected]/default?secure=true
Connect ClickHouse There are two main agreements , Native TCP and HTTP.
Native... Is recommended TCP.
clickhouse+native://<user>:<password>@<host>:<port>/<database>[?options…]
To configure Superset
We have successfully connected clickhouse, Let's use superset Build a dashboard .
First , Let's create a dataset . choice clickhouse-public As the connection , And then choose schema default and table ontime.

With the data set , It's easy to create the first chart . Just click the dataset name on the dataset page .Superset Will switch to a screen to define a chart , As shown below .

Create a time series chart

Publish charts in the dashboard .
choice DASHBOARD Button , Add the created chart in .


That's all Apache Superset visualization ClickHouse The whole process of data .
This article is shared from the author's personal site / Blog :https://www.cnblogs.com/tree1123/ Copy
If there is any infringement , Please contact me to delete .
边栏推荐
- [file upload vulnerability 04] server side mime detection and bypass experiment (based on upload-labs-2 shooting range)
- [Err] 1045 - Access denied for user ‘root‘@‘%‘ (using password: YES)
- STL container nested container
- 修改本地微信小程序的AppID
- Role of RESNET residual block
- ICML 2022 | 基于结构化数据的异常检测再思考:我们究竟需要怎样的图神经网络?...
- 7905 and TL431 negative voltage regulator circuit - regulator and floating circuit relative to the positive pole of the power supply
- Rule engine mode Net open source project case
- Implementation of SQL online editor based on Vue + codemirror
- 黑圆圈显示实现
猜你喜欢

STC hardware only automatic download circuit V2

Simulate Oracle lock waiting and manual unlocking

Implementation of SQL online editor based on Vue + codemirror

Modify appid of local wechat applet

Lanqi technology joins in, and dragon dragon dragon community welcomes leading chip design manufacturers again

C deep copy

Flutter doctor 显示xcode没有安装的解决办法

In 2021, the global revenue of Indian fragrant rice was about $12530 million, and it is expected to reach $21670 million in 2028

输入值“18-20000hz”错误,设置信息不完整,请选择单位

Database introduction
随机推荐
2022-2028 global and Chinese thermopile array module market status and future development trend
moderlarts第二次作业
浅谈UGUI中Canvas RectTransform的Scale
Interviewer: what is the event flow and event model in JS?
unity package manager starting server stuck(Unity启动卡在starting server,然后报错)
Wechat applet | rotation chart
Première formation sur les largeurs modernes
JMeter installation
In 2021, the global revenue of Indian fragrant rice was about $12530 million, and it is expected to reach $21670 million in 2028
秀创意,赢显卡!MMPose姿态估计创意大赛震撼来袭
桌面以及文件资源管理器无限重启的解决
Vectordrawable error
UI automated interview questions
Current situation and future development trend of global and Chinese cogeneration system market from 2022 to 2028
Date of SQL optimization_ Format() function
周刊02|不瞒你说,我其实是MIT的学生
2022-2028 global and Chinese thermal power generation (TEG) module market status and future development trend
2022-2028 global and Chinese thermopile detector Market Status and future development trend
Deploy website traffic statistics background based on Tencent cloud lightweight application server and umami
【数据可视化】Apache Superset 1.2.0教程 (三)—— 图表功能详解