superset是一个非常好用的数据可视化工具。
官网:apache/incubator-superset: Apache Superset (incubating) is a modern, enterprise-ready business intelligence web application
安装方法有2个,推荐使用docker进行安装:
git clone https://github.com/apache/incubator-superset/
cd incubator-superset/contrib/docker
# prefix with SUPERSET_LOAD_EXAMPLES=yes to load examples:
docker-compose run --rm superset ./docker-init.sh
# you can run this command everytime you need to start superset now:
docker-compose up
服务起来后打开网页127.0.0.1:8088进行访问。
如果要连到mysql的数据库,需要安装库,操作如下:
docker ps
docker exec -it CONTAINER_ID/bin/bash
python3 -m pip install mysqlclient
不安装的话会报错:
ERROR: {
"error": "Connection failed!\n\nThe error message returned was:\nNo module named 'MySQLdb'", "stacktrace": "Traceback (most recent call last):\n File \"/home/superset/superset/views/core.py\", line 1755, in testconn\n engine = database.get_sqla_engine(user_name=username)\n File \"/home/superset/superset/utils/core.py\", line 132, in __call__\n value = self.func(*args, **kwargs)\n File \"/home/superset/superset/models/core.py\", line 911, in get_sqla_engine\n return create_engine(url, **params)\n File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/__init__.py\", line 435, in create_engine\n return strategy.create(*args, **kwargs)\n File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py\", line 87, in create\n dbapi = dialect_cls.dbapi(**dbapi_args)\n File \"/usr/local/lib/python3.6/site-packages/sqlalchemy/dialects/mysql/mysqldb.py\", line 118, in dbapi\n return __import__(\"MySQLdb\")\nModuleNotFoundError: No module named 'MySQLdb'\n"}
不推荐:另一种是通过pip直接安装:
# Install superset
pip install superset
# Initialize the database
superset db upgrade
# Create an admin user (you will be prompted to set a username, first and last name before setting a password)
$ export FLASK_APP=superset
flask fab create-admin
# Load some data to play with
superset load_examples
# Create default roles and permissions
superset init
# To start a development web server on port 8088, use -p to bind to another port
superset run -p 8080 --with-threads --reload --debugger
这种方法在Windows下回报错:
Building wheel for superset (setup.py) ... error
ERROR: Complete output from command 'C:\Users\peter\Anaconda3\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\peter\\AppData\\Local\\Temp\\pip-install-60fd31ig\\superset\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\peter\AppData\Local\Temp\pip-wheel-rv2yqmmm' --python-tag cp37:

最低0.47元/天 解锁文章
2505

被折叠的 条评论
为什么被折叠?



