当前位置:网站首页>[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 .
边栏推荐
- sql优化之DATE_FORMAT()函数
- Current situation and future development trend of global and Chinese cogeneration system market from 2022 to 2028
- [computer exemption] the Internet of things and ubiquitous intelligence research center of Harbin Institute of technology recruits 2023 graduate students (Master, doctoral and direct doctoral) from un
- Current situation and future development trend of hot isostatic pressing service market in the world and China from 2022 to 2028
- 13 r basic exercises
- Black circle display implementation
- A Mechanics-Informed Artificial Neural Network Approach in Data-Driven Constitutive Modeling 学习
- 2022-2028 global and Chinese thermopile and microbolometer infrared detector Market Status and future development trend
- What is the meaning of holding shares of financial products?
- Usage methods and cases of PLSQL blocks, cursors, functions, stored procedures and triggers of Oracle Database
猜你喜欢

Global Market Consulting - Research Report on the overall scale and application segmentation of the global HVDC converter station market in 2022

unity package manager starting server stuck(Unity启动卡在starting server,然后报错)

Edit the project steps to run QT and opencv in the clion

Modelarts second job

STC 纯硬件自动下载电路 V2

Black circle display implementation

Compilation process of program

Yintai department store and Taobao tmall jointly create a green fashion show to help "carbon neutrality"

银泰百货与淘宝天猫联合打造绿色潮玩展,助力“碳中和”

Interpretation of OCP function of oceanbase Community Edition
随机推荐
Text to speech small software
Wechat applet | rotation chart
JMeter installation
php pcntl_fork 创建多个子进程解析
Lanqi technology joins in, and dragon dragon dragon community welcomes leading chip design manufacturers again
7905 and TL431 negative voltage regulator circuit - regulator and floating circuit relative to the positive pole of the power supply
Show your creativity and win the graphics card! Mmpose attitude estimation creative contest shocks
The input value "18-20000hz" is incorrect. The setting information is incomplete. Please select a company
浅聊对比学习(Contrastive Learning)第一弹
[Monday commuter radio station] cron expression. It's enough to read this article
STL容器嵌套容器
Chrome V8 source code 48 The secret of weak type addition,'+'source code analysis
Current situation and future development trend of thermoelectric generator Market in the world and China from 2022 to 2028
28. JS implementation mechanism
What is the meaning of holding shares of financial products?
Implementation of SQL online editor based on Vue + codemirror
[unity plug-in] shader keyword analysis tool shadercontrol
Installation and performance test of Apache APIs IX on Amazon graviton3
Première formation sur les largeurs modernes
Unity screenshot