Skip to content

Commit

Permalink
fix(issue #31927): TimeGrain.WEEK_STARTING_MONDAY (#32015)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianMastronardi authored Jan 29, 2025
1 parent f4efce3 commit a21f184
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions superset/db_engine_specs/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,10 @@ class SqliteEngineSpec(BaseEngineSpec):
TimeGrain.YEAR: "DATETIME({col}, 'start of year')",
TimeGrain.WEEK_ENDING_SATURDAY: "DATETIME({col}, 'start of day', 'weekday 6')",
TimeGrain.WEEK_ENDING_SUNDAY: "DATETIME({col}, 'start of day', 'weekday 0')",
TimeGrain.WEEK_STARTING_SUNDAY: (
"DATETIME({col}, 'start of day', 'weekday 0', '-7 days')"
),
TimeGrain.WEEK_STARTING_MONDAY: (
"DATETIME({col}, 'start of day', 'weekday 1', '-7 days')"
),
TimeGrain.WEEK_STARTING_SUNDAY: "DATETIME({col}, 'start of day', \
-strftime('%w', {col}) || ' days')",
TimeGrain.WEEK_STARTING_MONDAY: "DATETIME({col}, 'start of day', '-' || \
((strftime('%w', {col}) + 6) % 7) || ' days')",
}
# not sure why these are different
_time_grain_expressions.update(
Expand Down

0 comments on commit a21f184

Please sign in to comment.