Fix: date grouping for older SQLite versions (#2955)

This commit is contained in:
Vlad Stan
2025-02-12 13:23:38 +02:00
committed by GitHub
parent 15ba3c33a3
commit 16fbfd1c6f
3 changed files with 9 additions and 4 deletions
+6 -1
View File
@@ -86,7 +86,12 @@ class Compat:
if self.type in {POSTGRES, COCKROACH}:
return f"date_trunc('{group}', time)"
elif self.type == SQLITE:
return f"unixepoch(strftime('{sqlite_formats[group]}', time, 'unixepoch'))"
return (
"CAST (strftime('%s',datetime(strftime("
f"'{sqlite_formats[group]}'"
", time, 'unixepoch'))) AS INT)"
)
return "<bad grouping>"
@property