superset icon indicating copy to clipboard operation
superset copied to clipboard

sqlite month grain is calculating wrong

Open htruongaff opened this issue 10 years ago • 0 comments

I noticed the sqlite month grain is removing Day of the Month when it should be removing (day of the month -1).

  'sqlite': (
                Grain('Time Column', _('Time Column'), '{col}'),
                Grain('day', _('day'), 'DATE({col})'),
                Grain("week", _('week'),
                      "DATE({col}, -strftime('%w', {col}) || ' days')"),
                Grain("month", _('month'),
                      "DATE({col}, -strftime('%d', {col}) || ' days')"),
            ),

should be as below otherwise month grouping gives you the prior month.

                Grain("month", _('month'),
                      "DATE({col}, -(strftime('%d', {col}) -1) || ' days')"),
            ),

htruongaff avatar Oct 03 '16 05:10 htruongaff