mirror of https://github.com/apache/superset.git
Db2 Grain Correct Data Format (#2545)
* Db2 Grain Correct Data Format * Db2 Grain Correct Data Format. * Db2 Grain Correct Data Format + typo * Db2 Grain Correct Data Format +typo
This commit is contained in:
parent
fe68bc31c3
commit
62959ca38b
|
@ -195,14 +195,35 @@ class Db2EngineSpec(BaseEngineSpec):
|
|||
engine = 'ibm_db_sa'
|
||||
time_grains = (
|
||||
Grain('Time Column', _('Time Column'), '{col}'),
|
||||
Grain('second', _('second'), 'SECOND({col})'),
|
||||
Grain('minute', _('minute'), 'MINUTE({col})'),
|
||||
Grain('hour', _('hour'), 'HOUR({col})'),
|
||||
Grain('day', _('day'), 'DAY({col})'),
|
||||
Grain('week', _('week'), 'WEEK({col})'),
|
||||
Grain('month', _('month'), 'MONTH({col})'),
|
||||
Grain('quarter', _('quarter'), 'QUARTER({col})'),
|
||||
Grain('year', _('year'), 'YEAR({col})'),
|
||||
Grain('second', _('second'),
|
||||
'CAST({col} as TIMESTAMP)'
|
||||
' - MICROSECOND({col}) MICROSECONDS'),
|
||||
Grain('minute', _('minute'),
|
||||
'CAST({col} as TIMESTAMP)'
|
||||
' - SECOND({col}) SECONDS'
|
||||
' - MICROSECOND({col}) MICROSECONDS'),
|
||||
Grain('hour', _('hour'),
|
||||
'CAST({col} as TIMESTAMP)'
|
||||
' - MINUTE({col}) MINUTES'
|
||||
' - SECOND({col}) SECONDS'
|
||||
' - MICROSECOND({col}) MICROSECONDS '),
|
||||
Grain('day', _('day'),
|
||||
'CAST({col} as TIMESTAMP)'
|
||||
' - HOUR({col}) HOURS'
|
||||
' - MINUTE({col}) MINUTES'
|
||||
' - SECOND({col}) SECONDS'
|
||||
' - MICROSECOND({col}) MICROSECONDS '),
|
||||
Grain('week', _('week'),
|
||||
'{col} - (DAYOFWEEK({col})) DAYS'),
|
||||
Grain('month', _('month'),
|
||||
'{col} - (DAY({col})-1) DAYS'),
|
||||
Grain('quarter', _('quarter'),
|
||||
'{col} - (DAY({col})-1) DAYS'
|
||||
' - (MONTH({col})-1) MONTHS'
|
||||
' + ((QUARTER({col})-1) * 3) MONTHS'),
|
||||
Grain('year', _('year'),
|
||||
'{col} - (DAY({col})-1) DAYS'
|
||||
' - (MONTH({col})-1) MONTHS'),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in New Issue