mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
refactor: refine timestamp expr function (#21510)
This commit is contained in:
@@ -476,7 +476,6 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
|
||||
col: ColumnClause,
|
||||
pdf: Optional[str],
|
||||
time_grain: Optional[str],
|
||||
type_: Optional[str] = None,
|
||||
) -> TimestampExpression:
|
||||
"""
|
||||
Construct a TimestampExpression to be used in a SQLAlchemy query.
|
||||
@@ -484,10 +483,10 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
|
||||
:param col: Target column for the TimestampExpression
|
||||
:param pdf: date format (seconds or milliseconds)
|
||||
:param time_grain: time grain, e.g. P1Y for 1 year
|
||||
:param type_: the source column type
|
||||
:return: TimestampExpression object
|
||||
"""
|
||||
if time_grain:
|
||||
type_ = str(getattr(col, "type", ""))
|
||||
time_expr = cls.get_time_grain_expressions().get(time_grain)
|
||||
if not time_expr:
|
||||
raise NotImplementedError(
|
||||
|
||||
Reference in New Issue
Block a user