'DruidDatasource' object has no attribute 'database'
In http://localhost:8088/caravel/explore/druid/1/
Traceback (most recent call last):
File "/projects/druid/panoramix_test/caravel/views.py", line 445, in explore
payload = obj.get_json()
File "/projects/druid/panoramix_test/caravel/viz.py", line 236, in get_json
cache_timeout = self.cache_timeout
File "/projects/druid/panoramix_test/caravel/viz.py", line 222, in cache_timeout
self.datasource.database.cache_timeout or
AttributeError: 'DruidDatasource' object has no attribute 'database'
+1
"GET /caravel/explore/druid/2/?viz_type=table&granularity=one+day&since=7+days+ago&until=1+day+ago&row_limit=5000&include_search=false&metrics=count&flt_col_0=country_woeid&flt_op_0=in&flt_eq_0=&slice_id=&slice_name=&collapsed_fieldsets=&action=&datasource_name=fact_supply_xd&datasource_id=2&datasource_type=druid&previous_viz_type=table&json=true&force=true HTTP/1.1" 500 -
Ok found the fix but still trying to figure out the issue the fix is this - when you refresh metadata, the data source you are querying against needs to have cache timeout in the settings in the UI. If the field is left blank - then we get an error : i.e AttributeError: 'DruidDatasource' object has no attribute 'database' I even included the field in caravel_config.py like CACHE_DEFAULT_TIMEOUT=6000 but that didn't help either. The UI needs to have that field otherwise we get an exception here: https://github.com/airbnb/caravel/blob/master/caravel/viz.py#L225 the code goes into this if else condition (when the field is left blank): https://github.com/airbnb/caravel/blob/master/caravel/viz.py#L235
@mistercrunch I fixed the issue. I will send the PR asap
https://github.com/airbnb/caravel/pull/210
Stack Trace:
Traceback (most recent call last): File "/home/y/lib/python2.7/site-packages/caravel/views.py", line 446, in explore payload = obj.get_json() File "/home/y/lib/python2.7/site-packages/caravel/viz.py", line 270, in get_json cache.set(cache_key, payload, timeout=self.cache_timeout) File "/home/y/lib/python2.7/site-packages/caravel/viz.py", line 223, in cache_timeout self.datasource.database.cache_timeout or AttributeError: 'DruidDatasource' object has no attribute 'database' 2016-03-29 20:42:21,432:INFO:werkzeug:66.228.162.48 - - [29/Mar/2016 20:42:21] "GET /caravel/explore/druid/2/?viz_type=table&granularity=one+day&since=7+days+ago&until=now&row_limit=5000&include_search=false&metrics=count&flt_col_0=country_woeid&flt_op_0=in&flt_eq_0=&slice_id=&slice_name=&collapsed_fieldsets=&action=&datasource_name=fact_supply_xd&datasource_id=2&datasource_type=druid&previous_viz_type=table&json=true&force=true HTTP/1.1" 500 - Traceback (most recent call last): File "/home/y/lib/python2.7/site-packages/flask/app.py", line 1836, in call return self.wsgi_app(environ, start_response) File "/home/y/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/home/y/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "/home/y/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/home/y/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/y/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/y/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/home/y/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request return self.view_functionsrule.endpoint File "/home/y/lib/python2.7/site-packages/flask_appbuilder/security/decorators.py", line 26, in wraps return f(self, _args, *_kwargs) File "/home/y/lib/python2.7/site-packages/caravel/models.py", line 1113, in wrapper return f(_args, *_kwargs) File "/home/y/lib/python2.7/site-packages/caravel/views.py", line 451, in explore raise e AttributeError: 'DruidDatasource' object has no attribute 'database'
obj.get_json() throws an exception if cache timeout is not specified in the UI
This is now fixed in master please confirm