gpt4 book ai didi

python - 使用 mysql 数据库配置 apache 超集

转载 作者:行者123 更新时间:2023-11-29 09:30:49 31 4
gpt4 key购买 nike

我正在将 apache 配置为从 mysql 而不是 sqlite 读取;以下是我的配置文件中的详细信息。我不太明白如何配置上面的文件以从我的数据库中读取,以便我可以开始创建摘要:我已引用此文档进行设置。 https://superset.incubator.apache.org/installation.html

# Superset specific config
#---------------------------------------------------------
ROW_LIMIT = 200000
SUPERSET_WORKERS = 4

SUPERSET_WEBSERVER_PORT = 8088
#---------------------------------------------------------

#---------------------------------------------------------
# Flask App Builder configuration
#---------------------------------------------------------
# Your App secret key
SECRET_KEY = '\2\1t567fgj7dtghjdhfui64@#$&77cvw424tkey\1\2\e\y\y\h'

# The SQLAlchemy connection string to your database backend
# This connection defines the path to the database that stores your
# superset metadata (slices, connections, tables, dashboards, ...).
# Note that the connection information to connect to the datasources
# you want to explore are managed directly in the web UI
#SQLALCHEMY_DATABASE_URI = 'sqlite:////path/to/superset.db'
SQLALCHEMY_DATABASE_URI = 'mysql://username:password@localhost:3307/'

# Flask-WTF flag for CSRF
CSRF_ENABLED = True

# Set this API key to enable Mapbox visualizations
MAPBOX_API_KEY = ''

我运行以下命令来初始化我的项目

superset init

这会导致以下错误:

ERROR:flask_appbuilder.security.sqla.manager:DB Creation and initialization failed: 'NoneType' object has no attribute 'replace'

任何解决我的配置问题的指示都将受到高度赞赏

最佳答案

可能发生了两件事:

  1. 看来您的数据库 URI 的格式应为 mysql://username:password@host:port/dbname 而不仅仅是 mysql://username:password@host :port/(参见https://docs.sqlalchemy.org/en/13/core/engines.html#mysql以供引用)
  2. 您似乎希望连接到该 mysql 数据库以便查询它并可视化其数据 - 不要将其用作您的超集数据库后端(即数据库超集将用于保存您的超集配置)。对于后者,您可能最好只使用 sqlite。
    为了连接到您的目标数据库以实际查询它,请参阅 https://duperset.com/getting_started 上的“连接到您的目标数据库”

关于python - 使用 mysql 数据库配置 apache 超集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58787080/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com