1.caravel的配置文件路径
Found solution. Error happends because flask_manager could not find default db path for sqlite db. To fix this your need to change SQLALCHEMY_DATABASE_URI in caravel config.py
- Go to your anaconda / python directory.
- Open
%python_path%\Lib\site-packages\caravel\config.py
with text editor - Find row with SQLALCHEMY_DATABASE_URI connection string and change it according to your operation system / database setup. For windows you should type something like
'sqlite:///C:\\tmp\\caravel.db
shows the location of python install.
python -c "import os; print os.__file__"
2. 中文名字过长造成的UnicodeEncodeError
经常会出现这种问题
Traceback (most recent call last):
File "makedb.py", line 33, in
main()
File "makedb.py", line 30, in main
fp.write(row[1])
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-78: ordinal not in range(128)
解决方案: 在出问题的python脚步中添加:
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
3. 使用过程中频繁切换页面造成 IOError: [Errno 32] Broken pipe
2016-06-16_11:08:25.38299 Exception in thread Thread-1:
2016-06-16_11:08:25.38300 Traceback (most recent call last):
2016-06-16_11:08:25.38300 File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
2016-06-16_11:08:25.38300 self.run()
2016-06-16_11:08:25.38300 File "/usr/lib/python2.7/threading.py", line 763, in run
2016-06-16_11:08:25.38301 self.__target(*self.__args, **self.__kwargs)
2016-06-16_11:08:25.38301 File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 659, in inner
2016-06-16_11:08:25.38301 srv.serve_forever()
2016-06-16_11:08:25.38301 File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 499, in serve_forever
2016-06-16_11:08:25.38301 HTTPServer.serve_forever(self)
2016-06-16_11:08:25.38302 File "/usr/lib/python2.7/SocketServer.py", line 238, in serve_forever
2016-06-16_11:08:25.38302 self._handle_request_noblock()
2016-06-16_11:08:25.38302 File "/usr/lib/python2.7/SocketServer.py", line 297, in _handle_request_noblock
2016-06-16_11:08:25.38302 self.handle_error(request, client_address)
2016-06-16_11:08:25.38303 File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
2016-06-16_11:08:25.38304 self.process_request(request, client_address)
2016-06-16_11:08:25.38304 File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
2016-06-16_11:08:25.38304 self.finish_request(request, client_address)
2016-06-16_11:08:25.38304 File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
2016-06-16_11:08:25.38305 self.RequestHandlerClass(request, client_address, self)
2016-06-16_11:08:25.38305 File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
2016-06-16_11:08:25.38305 self.handle()
2016-06-16_11:08:25.38305 File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 216, in handle
2016-06-16_11:08:25.38306 rv = BaseHTTPRequestHandler.handle(self)
2016-06-16_11:08:25.38306 File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
2016-06-16_11:08:25.38306 self.handle_one_request()
2016-06-16_11:08:25.38306 File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 251, in handle_one_request
2016-06-16_11:08:25.38306 return self.run_wsgi()
2016-06-16_11:08:25.38307 File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 193, in run_wsgi
2016-06-16_11:08:25.38307 execute(self.server.app)
2016-06-16_11:08:25.38307 File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 184, in execute
2016-06-16_11:08:25.38307 write(data)
2016-06-16_11:08:25.38307 File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in write
2016-06-16_11:08:25.38308 self.wfile.write(data)
2016-06-16_11:08:25.38308 IOError: [Errno 32] Broken pipe
开发者之一的max是这样回复的:
"I think it has to do with using the debug server (`-d` flag when starting the web server), and concurrency perhaps. That debug web server is named Werkzeug and clearly shows in the stack trace. Remove the `-d` flag to get a more proper web server running (gunicorn)."
果然在去掉debug模式之后使用流畅了很多, 目前还没出过问题
4. caravel upgrade的问题
跟下面这哥们一样的问题:
I upgraded using pip install caravel --upgrade, which went well. After this when i ran caravel db upgrade i got following error
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) duplicate column name: verbose_name [SQL: 'ALTER TABLE table_columns ADD COLUMN verbose_name VARCHAR(1024)']
原因:
db在升级途中并没有指到最新的版本, 造成失败.
解决方案:
caravel db stamp f0fbf6129e13
# then proceed with
caravel db upgrade
参考:
https://groups.google.com/forum/#!topic/airbnb_caravel/-abyvcPRAtU
https://github.com/airbnb/caravel/issues/646
5.TypeError: 'unicode' does not have the buffer interface
某一天重启完caravel之后登陆突然报错, 查看了下是Werkzeug 0.9.4这个版本的bug.
将Werkzeug 升级到0.9.6之后的版本就解决了
6. 加入缓存redis配置
CACHE_DEFAULT_TIMEOUT = 30
CACHE_CONFIG = {'CACHE_TYPE': 'redis',
'CACHE_DEFAULT_TIMEOUT':30,
'CACHE_KEY_PREFIX':'caravel_',
'CACHE_REDIS_HOST':'127.0.0.1',
'CACHE_REDIS_PORT':6379,
'CACHE_REDIS_DB':1,
'CACHE_REDIS_URL':'redis://root@127.0.0.1:6379/1',}
7.汉化问题
官方现在虽然已经提供了汉化版本,但毕竟还有些不尽人意,比如说个人资料的profile翻译成轮廓我也是醉了。。如果想要自己做汉化,可以修改python安装目录下的相关.po文件,然后再编译。我的目录是在$PYTHON_HOME/site-packages/caravel-0.9.1-py2.7.egg/caravel/translations/zh/LC_MESSAGES
然后在caravel目录执行pybabel compile -d translations
但是类似下面panel之类的汉化,必须要修改appbuilder的汉化目录才能生效,目录在./lib/python2.7/site-packages/flask_appbuilder/translations/zh。
具体步骤可以参考http://blog.csdn.net/woshicsdn7547/article/details/52253483,此方法也适合于任何需要汉化的软件。
更新:
目前公司内部已经针对0.9.1版本做了大量的二次开发,因此没有再继续使用官方github的版本。以下是解决的issue和新增的功能:
1、已计算好的数据(不用聚合函数),无法用控件直接展示出来。
ps:这个功能我一直觉得是必备的,但官方只增加了table的,我们自己又重写了所有time series的控件。毕竟在RDBMS中数据量过大用caravel读取计算是很耗时间的,如果能在每天夜里将计算好结果再放入源表中,前端展示能节省很多时间,当然就不属于OLAP的范畴了:)
2、Dashboards展示时,slice中的字段排序无法根据实际定义顺序排序
3、展示时字段名称为数据库表字段名称,无法根据实际重命名
4、slice读取数据时无法自动排序,总是从数据库第一条数据开始展示
5、折线图/柱状图 x轴时间点显示错误
6、 table中的指标名称可以自定义备注,备注以浮窗效果显示
7、可以根据Dashboard限制查看权限,形成源表和dashboard两套权限机制
8、增加kylin数据源
9. 各种汉化问题,
10. 增加excel文档下载,方便业务人员查看(只会用word的说csv打开有问题)
11. 增加邮件发送定制日报 等。。