mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
convert postgresql date_trunc() to UTC to prevent pandas error (#4319)
* cast postgresql date_trunc() to timestamp without time zone to prevent pandas error * fix formatting for flake8 * change cast to timezone conversion instead
This commit is contained in:
parent
d5ab6c8d3d
commit
3b35ddf135
@ -288,14 +288,22 @@ class PostgresBaseEngineSpec(BaseEngineSpec):
|
|||||||
|
|
||||||
time_grains = (
|
time_grains = (
|
||||||
Grain('Time Column', _('Time Column'), '{col}'),
|
Grain('Time Column', _('Time Column'), '{col}'),
|
||||||
Grain('second', _('second'), "DATE_TRUNC('second', {col})"),
|
Grain('second', _('second'),
|
||||||
Grain('minute', _('minute'), "DATE_TRUNC('minute', {col})"),
|
"DATE_TRUNC('second', {col}) AT TIME ZONE 'UTC'"),
|
||||||
Grain('hour', _('hour'), "DATE_TRUNC('hour', {col})"),
|
Grain('minute', _('minute'),
|
||||||
Grain('day', _('day'), "DATE_TRUNC('day', {col})"),
|
"DATE_TRUNC('minute', {col}) AT TIME ZONE 'UTC'"),
|
||||||
Grain('week', _('week'), "DATE_TRUNC('week', {col})"),
|
Grain('hour', _('hour'),
|
||||||
Grain('month', _('month'), "DATE_TRUNC('month', {col})"),
|
"DATE_TRUNC('hour', {col}) AT TIME ZONE 'UTC'"),
|
||||||
Grain('quarter', _('quarter'), "DATE_TRUNC('quarter', {col})"),
|
Grain('day', _('day'),
|
||||||
Grain('year', _('year'), "DATE_TRUNC('year', {col})"),
|
"DATE_TRUNC('day', {col}) AT TIME ZONE 'UTC'"),
|
||||||
|
Grain('week', _('week'),
|
||||||
|
"DATE_TRUNC('week', {col}) AT TIME ZONE 'UTC'"),
|
||||||
|
Grain('month', _('month'),
|
||||||
|
"DATE_TRUNC('month', {col}) AT TIME ZONE 'UTC'"),
|
||||||
|
Grain('quarter', _('quarter'),
|
||||||
|
"DATE_TRUNC('quarter', {col}) AT TIME ZONE 'UTC'"),
|
||||||
|
Grain('year', _('year'),
|
||||||
|
"DATE_TRUNC('year', {col}) AT TIME ZONE 'UTC'"),
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user