Add having filters (#553)

Support the dimSelector having filters
This commit is contained in:
x4base
2016-06-21 11:43:10 -05:00
committed by Maxime Beauchemin
parent 13095eb550
commit 485234bc78
6 changed files with 195 additions and 92 deletions

View File

@@ -19,6 +19,7 @@ from flask import flash, Markup
from flask_appbuilder.security.sqla import models as ab_models
from markdown import markdown as md
from sqlalchemy.types import TypeDecorator, TEXT
from pydruid.utils.having import Having
class CaravelException(Exception):
@@ -77,6 +78,18 @@ class memoized(object): # noqa
return functools.partial(self.__call__, obj)
class DimSelector(Having):
def __init__(self, **args):
# Just a hack to prevent any exceptions
Having.__init__(self, type='equalTo', aggregation=None, value=None)
self.having = {'having': {
'type': 'dimSelector',
'dimension': args['dimension'],
'value': args['value'],
}}
def list_minus(l, minus):
"""Returns l without what is in minus