superset加载示例数据load_examples报错

项目场景:

superset安装好后到了加载官方示例数据这一步,需要运行指令load_examples,但不知道是不是墙的原因,总是报一个无法连接的错。

问题描述:

load_examples指令:

(venv) D:\WYJ\PyCharm Projects\superset-0.34\superset\bin>python superset load_examples

报错内容如下:

2021-05-06 14:11:30,320:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
Loading examples metadata and related data into examples
Creating default CSS templates
Loading energy related dataset
2021-05-06 14:11:31,234:INFO:root:Database.get_sqla_engine(). Masked URL: sqlite:///C:\Users\86185\.superset\superset.db
Traceback (most recent call last):
  File "superset", line 31, in <module>
    cli()
  File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\click\core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\flask\cli.py", line 586, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\click\core.py", line 697, in main
    rv = self.invoke(ctx)
  File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\click\core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\click\core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\click\decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\flask\cli.py", line 426, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "D:\WYJ\PyCharm Projects\superset-0.34\venv\lib\site-packages\click\core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "d:\wyj\pycharm projects\superset-0.34\superset\cli.py", line 143, in load_examples
    load_examples_run(load_test_data, only_metadata, force)
  File "d:\wyj\pycharm projects\superset-0.34\superset\cli.py", line 84, in load_examples_run
    examples.load_energy(only_metadata, force)
  File "d:\wyj\pycharm projects\superset-0.34\superset\examples\energy.py", line 38, in load_energy
    data = get_example_data("energy.json.gz")
  File "d:\wyj\pycharm projects\superset-0.34\superset\examples\helpers.py", line 73, in get_example_data
    content = request.urlopen(f"{BASE_URL}{filepath}?raw=true").read()
  File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 525, in open
    response = self._open(req, data)
  File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 543, in _open
    '_open', req)
  File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 503, in _call_chain
    result = func(*args)
  File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 1360, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 1320, in do_open
    r = h.getresponse()
  File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 1336, in getresponse
    response.begin()
  File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\http\client.py", line 267, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 1071, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\86185\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 929, in read
    return self._sslobj.read(len, buffer)
TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。

原因分析:

可能是国外服务器访问不太稳定,不过只是无法加载示例数据,不能展示酷炫的官方demo了,不影响suprset的其他使用。

解决方案:

把示例数据从GitHub上下载下来,放到本地服务器上,然后修改helpers.py文件中的BASE_URL。具体步骤如下:
1.下载GitHub示例数据
在这里插入图片描述
2.我用的是apache tomcat,它的根目录在~\webapps\ROOT。下载下来的压缩包解压后放到这个目录下。
在这里插入图片描述
3.在superset源码中找到helpers.py文件,把其中的BASE_URL改为自己的服务器地址。
在这里插入图片描述
然后就可以进行以后的步骤了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值