数据分析进阶-superset的使用

前言

上一篇博客已在阿里云服务器上部署好了superset,具体可以查看此链接,接下来将动手试一试~

superset的使用

superset的功能

superset支持多种数据库,可以自行配置,但是使用前需要安装对应的包,下面是superset的功能图
在这里插入图片描述

部署MySQL

在阿里云上部署并实现外网的内容,在此就不再赘述,具体可以查看此链接,里面有详细的操作步骤同时也对Navicat的连接中可能出现的问题做出了相应的解决方法

superset配置MySQL
各个数据库的安装都可以使用pip,下面以MySQL作为例子
pip3 install mysqlclient

然鹅报错了,如下:

Complete output from command python setup.py egg_info:
    /bin/sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-7qo1k7as/mysqlclient/setup.py", line 18, in <module>
        metadata, options = get_config()
      File "/tmp/pip-install-7qo1k7as/mysqlclient/setup_posix.py", line 53, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-install-7qo1k7as/mysqlclient/setup_posix.py", line 28, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-7qo1k7as/mysqlclient/

这个时候则输以下命令

sudo apt-get install mysql-server mysql-client
# 然后mysql -V查看mysql是否安装成功
sudo apt-get install libmysqlclient-dev
# 再次安装
pip3 install mysqlclient
# 这个时候就成功了
superset连接MySQL

选择source-database,然后按右上角的+号即可
在这里插入图片描述
然后按要求输入URI并测试以下,例如

# 不同的数据库前缀不一,可自行看文档
mysql://用户名:密码@IP/数据库名

若成功则出现下图,不成功可以根据其中的提示进行debug
在这里插入图片描述
后续则是对数据库操作的一些限制,因为这个是测试数据库,所以我就随便使用了,保存之后就可以看到刚刚设置的数据库
在这里插入图片描述
接下来就是对数据的提取和可视化操作了,去SQL Lab-SQL Editor可以看到我们的数据库,同时可以写SQL语句进行提取(也可以预览我们的数据表),还可以对SQL进行存储,比较方便
在这里插入图片描述
另外可以去source-Tables添加数据库的表格,后续可以进行group、filter、count、sum、min、max等操作
在这里插入图片描述

superset可视化

其中自带多种图表可供选择
在这里插入图片描述

发布了55 篇原创文章 · 获赞 30 · 访问量 9万+

猜你喜欢

转载自blog.csdn.net/Totoro1745/article/details/104262828
今日推荐