This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 3b18fbf  db_engine_specs: use correct sqlite week time grain (#4831)
3b18fbf is described below

commit 3b18fbf9e3d5feda781004ae229927524a098ecc
Author: Riccardo Magliocchetti <riccardo.magliocche...@gmail.com>
AuthorDate: Mon Apr 16 01:15:31 2018 +0200

    db_engine_specs: use correct sqlite week time grain (#4831)
    
    We want the week of year %W and not the day of week %w
    when using week as time grain.
    
    Reference:
    https://www.sqlite.org/lang_datefunc.html
---
 superset/db_engine_specs.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index d239f89..0c7444c 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -424,7 +424,7 @@ class SqliteEngineSpec(BaseEngineSpec):
               'PT1H'),
         Grain('day', _('day'), 'DATE({col})', 'P1D'),
         Grain('week', _('week'),
-              "DATE({col}, -strftime('%w', {col}) || ' days')",
+              "DATE({col}, -strftime('%W', {col}) || ' days')",
               'P1W'),
         Grain('month', _('month'),
               "DATE({col}, -strftime('%d', {col}) || ' days', '+1 day')",

-- 
To stop receiving notification emails like this one, please contact
maximebeauche...@apache.org.

Reply via email to