mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix(metadb): handle durations (#25727)
This commit is contained in:
@@ -155,6 +155,15 @@ def has_rowid(method: F) -> F:
|
||||
return cast(F, wrapper)
|
||||
|
||||
|
||||
class Duration(Field[datetime.timedelta, datetime.timedelta]):
|
||||
"""
|
||||
Shillelagh field used for representing durations as `timedelta` objects.
|
||||
"""
|
||||
|
||||
type = "DURATION"
|
||||
db_api_type = "DATETIME"
|
||||
|
||||
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
class SupersetShillelaghAdapter(Adapter):
|
||||
|
||||
@@ -180,6 +189,7 @@ class SupersetShillelaghAdapter(Adapter):
|
||||
datetime.date: Date,
|
||||
datetime.datetime: DateTime,
|
||||
datetime.time: Time,
|
||||
datetime.timedelta: Duration,
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user