1
- from enum import Enum
1
+ from metabase . mbql . base import Mbql , Option
2
2
3
- from metabase .mbql .base import Field
4
3
5
-
6
- class TemporalOption (Enum ):
4
+ class TemporalOption (Option ):
7
5
MINUTE = {"temporal-unit" : "minute" }
8
6
HOUR = {"temporal-unit" : "hour" }
9
7
DAY = {"temporal-unit" : "day" }
@@ -21,24 +19,13 @@ class TemporalOption(Enum):
21
19
QUARTER_OF_YEAR = {"temporal-unit" : "quarter-of-year" }
22
20
23
21
24
- class BinOption (Enum ):
22
+ class BinOption (Option ):
25
23
AUTO = {"binning" : {"strategy" : "default" }}
26
24
BINS_10 = {"binning" : {"strategy" : "num-bins" , "num-bins" : 10 }}
27
25
BINS_50 = {"binning" : {"strategy" : "num-bins" , "num-bins" : 50 }}
28
26
BINS_100 = {"binning" : {"strategy" : "num-bins" , "num-bins" : 100 }}
29
27
NONE = None
30
28
31
29
32
- class GroupBy (Field ):
33
- def __init__ (self , field_id : int , option = None ):
34
- super (GroupBy , self ).__init__ (id = field_id , option = option )
35
-
36
-
37
- class TemporalGroupBy (GroupBy ):
38
- def __init__ (self , field_id : int , option : TemporalOption ):
39
- super (TemporalGroupBy , self ).__init__ (field_id = field_id , option = option .value )
40
-
41
-
42
- class BinnedGroupBy (GroupBy ):
43
- def __init__ (self , field_id : int , option : BinOption ):
44
- super (BinnedGroupBy , self ).__init__ (field_id = field_id , option = option .value )
30
+ class GroupBy (Mbql ):
31
+ pass
0 commit comments